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

Re: assigning array to hash

Thread Previous | Thread Next
From:
Shaun Fryer
Date:
April 29, 2002 14:53
Subject:
Re: assigning array to hash
Message ID:
Pine.BSO.4.21.0204291739440.19770-100000@zeus.sorcery.ca
> http://www.wetware.com/drieux/CS/lang/Perl/Beginners/BenchMarks/loopVjoin.txt
> drieux

Thanks Drieux,
	I had no idea this could even be done.

---
$hash{$jref_key} = \@array;
my @new_array = @{$hash{$jref_key}};    
---

	Guess why I'm on this list? ;) I have one tiny question though
(from your web-page above).

---
### sub refFunc {
### 	$hash{$ref_key} = [@array];
### 	my @new_array = @{$hash{$ref_key}};    
### } # end of refFunc
### 
### sub JustRef {
### 	$hash{$jref_key} = \@array;
### 	my @new_array = @{$hash{$ref_key}};    
### } # end of JustRef

	Shouldn't the second last line read...

---
my @new_array = @{$hash{$jref_key}};
---

	? It looks like JustRef() is creating @new_array based on the
hash value previously created in refFunc().

===================
 Shaun Fryer
===================
 London Webmasters
 http://LWEB.NET
 PH:  519-858-9660
 FX:  519-858-9024
===================


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