in reply to Using references as hash keys
re "allows one to use references as hash keys", I didn't realise this was a problem so to be certain I tried this:
...it produced the expected kind of results, i.e.:#!/usr/bin/perl use Data::Dumper; my $var = "VARVALUE"; my @arr = ( 'ARRVAL1', 'ARRVAL2' ); my %hash = ( hashkey1 => hashval1, hashkey2 => hashval2 ); open my $fh, "| more"; my %HOfR = ( \$var => "valForRefOfVar", \@arr => "valForRefOfArr", \%hash => "valForRefOfHash", \&Sub => "valForRefOfSub", $fh => "valForRefOfGlob" ); print Dumper( \%HOfR ); sub Sub { };
which makes me wonder what the original problem actually is.$VAR1 = { 'ARRAY(0x2ddf0)' => 'valForRefOfArr', 'SCALAR(0x2ddd8)' => 'valForRefOfVar', 'GLOB(0x228b4)' => 'valForRefOfGlob', 'HASH(0x2ddcc)' => 'valForRefOfHash', 'CODE(0x456cc)' => 'valForRefOfSub' };
-M
Free your mind
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Using references as hash keys
by Roy Johnson (Monsignor) on Oct 18, 2005 at 14:22 UTC |
In Section
Seekers of Perl Wisdom