I want to open a file whose name should be given as string to the open() function in Perl.How can it be achieved.
I have the following code shown below, which shows some errors in second open statement
use strict;
use warnings;
my $globalpath = "/lhome/tirumala2/cvadlapu_view2/3rdparty/embedded/bsa_examples/linux/";
my $line;
open (TEXT_FILE, "/lhome/tirumala2/DDT_expect_module/test_strings.txt");
while ($line = <TEXT_FILE>)
{
print "$line";
open ( APP_FILE, "/lhome/tirumala2/cvadlapu_view2/3rdparty/embedded/bsa_examples/linux/$line/source/$line.c") or die "Cant open application file";
}
$globalpathvariable in the shown code.newline characterin$linevariable. So try to chomp it first and see, it should work.Try something like: