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

Re: assigning array to hash

Thread Previous | Thread Next
From:
richard noel fell
Date:
April 26, 2002 10:11
Subject:
Re: assigning array to hash
Message ID:
3CC98E4B.35896F35@rcn.com
Drieux -
	Thanks. I altered the LABEL_FILE data format as you suggested and all
works just fine now.
Dick

Drieux wrote:
> 
> On Friday, April 26, 2002, at 06:55 , Jeff 'japhy' Pinyan wrote:
> 
> > The hash is not empty -- printing "%foo" does nothing special.  To dump a
> > hash, do something like:
> >
> >   for (keys %hash) {
> >     print "$_ => $hash{$_}\n";
> >   }
> 
> we of course presume that Richard already remembers two
> small niggline details:
> 
> ###     while ( <LABEL_FILE>)
> ###       {
> ###             chomp;
> ###         push(@label_array,$_);
> ###
> ###       }
> 
> the 'chomp' there will take the 'new line' out of the data
> which may be useful especially for the 'index' into the hash part
> 
> and secondly that the data in the LABEL_FILE on this line
> by line walk needs to be formed:
> 
>         key
>         val
>         key1
>         val1
> 
> http://www.wetware.com/drieux/CS/lang/Perl/Beginners/ArrayToHash.txt
> 
> ciao
> drieux
> 
> ---

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