Hi, All:
I want to test if a file exists or it is a link or not, the code is:
#!/usr/bin/perl -w
use strict;
use File::Basename;
use File::stat;
use Fcntl ':mode';
my $elfobj = $ARGV[0];
sub strtrim ()
{
#.....
}
sub copyfile ()
{
#.....
}
my @deps = `ldd $elfobj`;
foreach my $lib (@deps) {
chomp ($lib);
my ($dep,$path) = split ("=>", $lib);
##handle path, and it value is /lib64/ld-linux-x86-64.so.2, which
is a link file.
if (-e $path) {
print $path."\n";
}
}
But the highlighted code always return undef. When put the code outside
of the foreach, it ok. Any one encountered this situation?