$! was an unfortunate choice of variable. :-) It's a dualvar so it has different values if treated as a string or as a numerical.
It's better to just create a copy and pass that, if the subroutine doesn't copy the argument.open my $fh, '<', 'this does not exist'; printf "%s (%d)\n", $!, $!; __END__ No such file or directory (2)
lodin
In reply to Re^4: Perl cheat sheet (dualvars)
by lodin
in thread Perl cheat sheet
by Juerd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |