Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

RE: RE: RE: mybooks.pl (or or )

by tye (Sage)
on Aug 09, 2000 at 08:29 UTC ( [id://26956]=note: print w/replies, xml ) Need Help??


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")

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://26956]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 06:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found