Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Hash slice syntax question

by ibm1620 (Beadle)
on Jul 12, 2013 at 21:04 UTC ( #1044077=perlquestion: print w/ replies, xml ) Need Help??
ibm1620 has asked for the wisdom of the Perl Monks concerning the following question:

%table_manager_info is a hash of hashes, and I want to store a list of two values into the 2nd level hash. I'm trying to use hash slice syntax but failing everything I try.

get_registered_process_path($instance_name) definitely returns an array, so the problem must be on the LHS of the assignment statement.

Any help greatly appreciated!

my @foo = get_registered_process_path($instance_name); @{$table_manager_info{$instance_name}->{qw/process_directory process_f +ile_name/}} = @foo;

Comment on Hash slice syntax question
Download Code
Re: Hash slice syntax question
by choroba (Abbot) on Jul 12, 2013 at 21:08 UTC
    You were almost there:
    @{ $table_manager_info{$instance_name} }{ qw/process_directory process +_file_name/ } = @foo;
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      Ah... "the array of values selected from the hash by an array of keys." Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1044077]
Approved by Happy-the-monk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (12)
As of 2014-12-29 16:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (193 votes), past polls