Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: one hash value (array) into another

by calin (Deacon)
on Jan 20, 2004 at 19:26 UTC ( [id://322679]=note: print w/replies, xml ) Need Help??


in reply to one hash value (array) into another

If you want different arrays, with the same scalar things inside, you can do:

use Data::Dumper; $h{a} = [qw/x y z/]; $h{b} = &{sub {\@_}}(@{$h{a}}); $h{a}->[0] = 'new_x_is_shared'; push @{$h{a}}, 'pusher_is_not_shared'; print Dumper $h{a}; print Dumper $h{b};

with the output:

$VAR1 = [ 'new_x_is_shared', 'y', 'z', 'pusher_is_not_shared' ]; $VAR1 = [ 'new_x_is_shared', 'y', 'z' ];

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-26 04:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found