Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Possible pitfall with Slices

by Fastolfe (Vicar)
on Nov 07, 2000 at 00:59 UTC ( #40240=note: print w/replies, xml ) Need Help??


in reply to Possible pitfall with Slices

A better way of doing this:
@a{qw{ a b c }} = (); # not (1)x3 or whatever foreach (qw{ a b c }) { print "$_\n" if exists $a{$_}; }
Thus we don't have to worry about being sure the values of the hash are all present and what-not. Specify an empty list on the right-hand-side to set the values all to undef, and just use exists to see if it's there. It's also slightly faster (but not much).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2016-10-01 17:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (2 votes). Check out past polls.