• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

problem in checking file exists or not.plz help me

bhas85

Junior Member
Hi All,

I had a problem in checking file exists or not.I need to check the files in list.txt and the same file is there in files directory or not.the if statment is not working.please suggest me.

!/usr/bin/perl
$PATH1='/home/n1013141/vijay/list.txt'
$PATH2='/home/n1013141/vijay/files'
open FILE, '$PATH1' or die "Can't open file: $!\n";
my @array = <FILE>;
close(FILE);
foreach $line (@array)
{
print $line;
if ( -e $PATH2/$_ )
{
print $PATH2/$_ "exists \n";
}
else
print $PATH2/$_ "not exists \n";
}
}
 
Hint: "$a/$b" returns a string. $a/$b is a division operator.
 
Back
Top