Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: Short or Long Hand

by Eimi Metamorphoumai (Deacon)
on Aug 12, 2004 at 15:30 UTC ( #382302=note: print w/ replies, xml ) Need Help??

in reply to Re: Short or Long Hand
in thread Short or Long Hand

That won't quite work--you need parens.

print $day, $/ if $day !~ /^(?:0|6)$/;
print $day, $/ if $day !~ /^[06]$/;

Comment on Re^2: Short or Long Hand
Select or Download Code
Replies are listed 'Best First'.
Re^3: Short or Long Hand
by Dietz (Curate) on Aug 12, 2004 at 15:37 UTC
    It will work without parens as long as $day is a weekday field ranging 0..6
    Char class ( [06] ) is another good idea since it is faster then the alteration but you wouldn't determine the speed diff on a single digit.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2015-11-25 02:11 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (667 votes), past polls