: -----Original Message----- : From: Paul Kraus [mailto:[EMAIL PROTECTED] : Sent: Monday, January 26, 2004 10:52 AM : To: 'Charles K. Clarkson'; 'Perl Beginners' : Subject: RE: hash of hash of array slices : : : > Paul Kraus <[EMAIL PROTECTED]> wrote: : > : : > : This works : > : : > : Foreach ( @{$hash{$key1}{$key2}} ) : > : : > : This does note : > : : > : Foreach ( @{($hash{$key1}{$key2})[9..1]} ) : > : : > : This gives me this error .... : > : Can't use undefined value as an array reference. : > : : > : > : > foreach ( reverse @{ $hash{$key1}{$key2} }[ 1 .. 9 ] ) { : That was a typo should have read [ 1..10] : : And the code doesn't work.
Worked for me: my( $key1, $key2 ) = qw| foo bar |; my %hash; $hash{$key1}{$key2} = [ 0 .. 20 ]; foreach ( reverse @{ $hash{$key1}{$key2} }[ 1 .. 9 ] ) { print "$_\n"; } Charles K. Clarkson -- Head Bottle Washer, Clarkson Energy Homes, Inc. Mobile Home Specialists 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>