Phoenix.pm: quiz

Tran Forsythe forsythe at primenet.com
Thu Dec 16 01:06:08 CST 1999


>This little bit of code gave me the RCA dog look for a while.  After
thinking
>it through, it made sense.
>
>If references are not your strong suit, then read on.
>What will the final print statement say for each of these snippets?
>
>$hash = {1=>one, 2=>two, 3=>three};
>$list = [fred, barney, $hash, wilma];
>$hash = {1=>ONESIE,2=>TWOSIE,3=>THREESIE};
>print STDOUT "value is:'$$list[2]{2}' "   # is it 'two' or 'TWOSIE'
>
>$hash = {1=>one, 2=>two, 3=>three};
>$list = [fred, barney, $hash, wilma];
>$$hash{2} = TWOSIE;
>print STDOUT "value is:'$$list[2]{2}' "   # is it 'two' or 'TWOSIE'
>
>__END__
>
>So what is it?
>
>Just another of my little Perl pseudo-gotchas...
>
>Tim

Hmm.. or will it error out as it's missing two ;'s? ;)  A good puzzle
though, took me a few ;)




More information about the Phoenix-pm mailing list