uksza has asked for the wisdom of the Perl Monks concerning the following question:
and output:#!/usr/bin/perl use strict; use warnings; my %pets; my $color; $color="black"; $pets{$color}=\[]; push @${$pets{$color}},"cat"; push @${$pets{$color}},"dog"; $color="while"; $pets{$color}=\[]; push @${$pets{$color}},"rat"; push @${$pets{$color}},"bat"; foreach my $p (values %pets) { print "$p\n"; #^^^this is ref to ref to array? print "$$p\n"; #^^^this is ref to array print "@$$p\n\n"; #^^^this is array }
@$$p looks very strange.push @${$pets{$color}},"rat"; REF(0x815c4d0) ARRAY(0x815c4e8) rat bat REF(0x812ed0c) ARRAY(0x812ed48) cat dog
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cruel references
by japhy (Canon) on Mar 06, 2005 at 00:27 UTC | |
by uksza (Canon) on Mar 06, 2005 at 00:51 UTC | |
|
Re: Cruel references
by trammell (Priest) on Mar 06, 2005 at 00:53 UTC |