Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Assign (key, value) to a hash w/o clobbering hash

by rjray (Chaplain)
on Sep 28, 2006 at 08:34 UTC ( [id://575305]=note: print w/replies, xml ) Need Help??


in reply to Assign (key, value) to a hash w/o clobbering hash

How about:

@X_delimited_strings = qw(fooXbar bishXbash); for (@X_delimited_strings) { @_ = split /X/; $hash{$_[0]} = $_[1]; }

You will have to accept a temp variable somewhere. You can use those already available to you (like $_ and @_) or declare your own.

--rjray

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-23 22:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found