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";
}
}
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";
}
}