develooper Front page | perl.beginners | Postings from April 2002

Re: assigning array to hash

Thread Previous | Thread Next
From:
Jeff 'japhy' Pinyan
Date:
April 26, 2002 06:56
Subject:
Re: assigning array to hash
Message ID:
Pine.GSO.4.21.0204260955110.18750-100000@crusoe.crusoe.net
On Apr 26, richard noel fell said:

>Below is part of some code that reads from a file to an array and then
>attempts to assign the array to a hash.  I get no compiling errors, but
>%label_hash is empty. No doubt I am being stupid. Has anyone a
>suggestion how to fill the hash variable?

The hash is not empty -- printing "%foo" does nothing special.  To dump a
hash, do something like:

  for (keys %hash) {
    print "$_ => $hash{$_}\n";
  }

-- 
Jeff "japhy" Pinyan      japhy@pobox.com      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About