I am new to perl and just found very unexpected behavior.
I use transition from File::Copyto rename a folder. It works as expected, but when I look at the return value variable $!after that, it shows an error.
File::Copy
$!
Relevant code that I use:
$helpr =~ s/\./ /g; move($file,$helpr); print $!;
Exit:
[j@box test]$ ls my.test.dir [j@box test]$ fileRenamer.pl No such file or directory [j@box test]$ ls my test dir
Why do I get an error code when the work is done? What am I missing?
Thanks everyone!
As mpapec says, you shouldn't use an error message unless moveit returns false, for example. a ... or die $!. However, why is this happening:
move
... or die $!
, , File::Copy $!. :
($tosz1,$tomt1) = (stat($to))[7,9];
$to - , . , , , , , $!. .
$to
$! , move() ( false),
move()
move($file,$helpr) or print $!;