Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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)$/;
or
print $day, $/ if $day !~ /^[06]$/;


Comment on Re^2: Short or Long Hand
Select or Download Code
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2014-07-30 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (230 votes), past polls