in reply to RE: RE: mybooks.pl (or or )
in thread mybooks.pl
And in the case we are discussing here, || is very much wrong. Consider the first example of || die in the posted code:
mkdir "$dir", 0777 || die "Could not mkdir \"$dir\": $!\n";
Here is a demonstration of why this is wrong:
my $dir= "source"; # A directory that I know exists. warn "Using or...\n"; mkdir "$dir", 0777 or die "Could not mkdir \"$dir\": $!\n"; warn "Using ||...\n"; mkdir "$dir", 0777 || die "Could not mkdir \"$dir\": $!\n"; warn "Done.\n";
This produces the following output:
E:\etm\Work>perl -w mkdir.pl Using or... Could not mkdir "source": File exists Using ||... Done.
Note that -w was silent as well, so I'm not sure when it will warn me of a precedence problem (I'm using Perl 5.6.0).
- tye (but my friends call me "Tye")
In Section
Code Catacombs