Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2015-07-05 20:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls