Results 1 to 3 of 3

Thread: perl and anonymous hashes

  1. #1
    Senior Member
    Join Date
    May 2002
    Posts
    344

    perl and anonymous hashes

    Hey i am coding in perl and i need some help accessing an anonymous hash within an array. When i use Data:umper to print what the array looks like to see what the hash looks like, this is what i get:

    Code:
    $VAR1 = [
                     {
                       'Tree' => 'fir',
                       'DBH' => '23',
                       'Height' => '80',
                       'Growth' => "1.2"
                      }
                     {
                       'Tree' => 'redwood',
                       'DBH' => '32',
                       'Height' => '134',
                       'Growth' => "3.2"
                      }
                    ];
    that isnt completely accurate (i might have missed a space or something) since i couldnt copy it and had to hand type it all out, but you get the point. Anyways i want to access the value in the 'Tree' key but i dont know how to get it. Any help would be much appriciated. Thanks in advance!
    Support your right to arm bears.


    ^^This was the first video game which i played on an old win3.1 box

  2. #2
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    I'm not sure I understand, but can't you just do
    Code:
    %variable{'Tree'}
    ?

  3. #3
    Senior Member
    Join Date
    May 2002
    Posts
    344
    alright well i figured out the answer to my own problem because i am special like that

    Code:
    print "\t\tTree: ",$arrayPlot[0]->[0]->{"Tree"},"\n";

    also this is a really stupid quetion i guess, but if i have perl code i wrote a on unix system and i want to turn it into an .exe for a windows system so i can just open up the program and run it, how would i do that?


    **EDIT**
    so i found a program that does what i want called Perl2Exe. I am wondering how to install this thing on Cygwin. I am a total n00b when it comes to windows and a total n00b when it comes to linux, so help me out please. I also want to update cygwin, but i dont quite get how to do that. Anyways, maybe i should be starting a new thread in the newbie forum, but any help is much appriciated!
    Support your right to arm bears.


    ^^This was the first video game which i played on an old win3.1 box

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •