A
Abhinav
Hi,
I am reading the name of a file from STDIN.
I am using the following :
my $fileToCheck = <STDIN>;
chomp ($fileToCheck);
if (-e $fileToCheck)
{
print "Not Found\n";
}
The problem is that I want to allow the user to specify the file with
environment variables in some way. For example, to check if x.pl is present
under the home directory, the user should be able to give
$HOME/x.pl
However, it seems that we cannot interpolate like this while reading from
STDIN (or from a file)? Am I missing something ?
I tried $ENV{HOME}/x.pl also, but it also gave the same error :
No such file or directory
TIA
I am reading the name of a file from STDIN.
I am using the following :
my $fileToCheck = <STDIN>;
chomp ($fileToCheck);
if (-e $fileToCheck)
{
print "Not Found\n";
}
The problem is that I want to allow the user to specify the file with
environment variables in some way. For example, to check if x.pl is present
under the home directory, the user should be able to give
$HOME/x.pl
However, it seems that we cannot interpolate like this while reading from
STDIN (or from a file)? Am I missing something ?
I tried $ENV{HOME}/x.pl also, but it also gave the same error :
No such file or directory
TIA