On Nov 10, 2016, at 2:30 AM, jaceke <jac...@op.pl> wrote:
> 
> Hi,
> how can I check if file exist or not ?
>  
> Here's a short test/example:
>  
> if (-e '/etc/passwd')
> {
> printf "File exist !\n";
> } else {
> printf "File not exist !\n";
> }
>  
> That works great !
>  
> but next a short test/example:
>  
> my $f1 = '/etc/passwd';
>  
> if (-e $f1)
> {
> printf "File exist !\n";
> } else {
> printf "File not exist !\n";
> }
>  
> and that NOT working ! Why ?
>  
> I use quotes because my path contain special characters.

Both of those versions work on my system. There is no reason for the version 
using a scalar variable holding the file path not to work.

Can you post a complete, short, working program that you think does not work?


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to