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

Re: assigning array to hash

Thread Previous | Thread Next
From:
drieux
Date:
April 26, 2002 07:38
Subject:
Re: assigning array to hash
Message ID:
36AE8D70-5923-11D6-83D8-0030654D3CAE@wetware.com

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