Anno Siegel wrote:
> Abhinav <> wrote in comp.lang.perl.misc:
>
>>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
>
>
> Untested:
>
> chomp( my $fileToCheck = <STDIN>);
> $fileToCheck =~ s/\$(\w+)/$ENV{ $1}/g;
>
> Is that what you're after?
>
Exactly !
I thought this could be done directly by reading the input, specified in
*some* way, without having to modify it..
This is good enough
Thanks
--
Abhinav