in reply to Problem to store referrence as key value in a hash

#!/usr/bin/perl use strict; use warnings; my $a=10; my %b; $b{\$a}= $a; while ( my ($key, $value) = each %b) { print "$key => $b{$key}\n"; }

Output:
SCALAR(0x814f5c4) => 10

HTH,

PooLpi

Replies are listed 'Best First'.
Re^2: Problem to store referrence as key value in a hash
by grinder (Bishop) on Jan 11, 2008 at 14:03 UTC
    Output:
    SCALAR(0x814f5c4) => 10

    Err, whatever. Now multiply SCALAR(0x814f5c4) by 2 and tell me the result is 20 :)

    • another intruder with the mooring in the heart of the Perl

      No but :
      print pack('h', 0x814f5c4)
      will give you a nice smiling face ☺
      { use charnames ':full'; my $smiling_face = "\N{WHITE SMILING FACE}"; }
      Tested under XP and the latest Cygwin

      PooLpi ;)