Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

How to access hash and push it in scalar variable

by Anonymous Monk
on Sep 16, 2014 at 06:28 UTC ( [id://1100694]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hey Monks, I have a Little question for you and I hope you can help me. I have a hash, which Looks like this:
VAR1 = 'key' => { 'individual name' = > [ [coordinates], [Rotation], [ +height]] }
I need to know, how I can Access to the coordinates, the Rotation and height and how to save them in an Array or a scalar variable. I'm looking Forward to every Kind of help. Regards

Replies are listed 'Best First'.
Re: How to access hash and push it in scalar variable
by Athanasius (Archbishop) on Sep 16, 2014 at 06:41 UTC

    This should get you started:

    #! perl use strict; use warnings; my %hash = ( key => {'individual name' => [['coordinates'], ['Rotation'], ['hei +ght']]}, ); my $coords = $hash{key}->{'individual name'}[0][0]; my $rotation = $hash{key}->{'individual name'}[1][0]; my $height = $hash{key}->{'individual name'}[2][0]; print "$_\n" for ($coords, $rotation, $height);

    Output:

    16:38 >perl 1014_SoPW.pl coordinates Rotation height 16:38 >

    See perlreftut.

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      thank you a lot. works perfektly for me!!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2024-04-19 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found