Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to File::Copy::move a glob of files
I tried testing for $! and get a failure message
for each file when it actually succeeded!
What am i missing??
Here's a code snippet (assume the glob array is ok)
(perl 5.6.1/linux)
# ------------------------ foreach my $f (@myGlob) { $!=''; # STILL complaining if (-l $f) { next; } move ($f,$RecBak) if (-f $f); # failed to skip symbolic links # till I said if -l $f next (why!?) if ($!) { print "\$!:[$!] $f FAILED! } else { print "$f moved" ;} } # ----------------------
This succeeds in moving all and only regular files
as intended, but claims to fail!!
$! is always "no such file or directory".
I'm stuck..
thanks in advance,
- manchot
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File::Copy move $! is "no such file" even on success
by Abigail-II (Bishop) on Sep 12, 2003 at 15:03 UTC | |
|
Re: File::Copy move $! is "no such file" even on success
by jeffa (Bishop) on Sep 12, 2003 at 15:07 UTC | |
|
Re: File::Copy move $! is "no such file" even on success
by hardburn (Abbot) on Sep 12, 2003 at 14:56 UTC | |
by Abigail-II (Bishop) on Sep 12, 2003 at 15:08 UTC | |
|
Re: File::Copy move $! is "no such file" even on success
by Anonymous Monk on Sep 12, 2003 at 15:15 UTC | |
|
Re: File::Copy move $! is "no such file" even on success
by Anonymous Monk on Sep 12, 2003 at 15:07 UTC | |
by jeffa (Bishop) on Sep 12, 2003 at 15:21 UTC |