in reply to Simple Hash Question

Not sure if I am missing something, but if you want to print the key, print the key:

for my $key ( sort {$hash{$a} <=> $hash{$b} } keys %hash ) { print " MIRACLE_HAPPENS is equal to key : \'$key\' and value : \' +$hash{$key}\'.\n"; }

perldoc may be a good resource for further reading. HTH.

Just a something something...

Replies are listed 'Best First'.
Re^2: Simple Hash Question
by johngg (Canon) on Nov 18, 2009 at 22:44 UTC

    A minor point but you don't have to escape single-quotes in a double-quoted string.

    $ cat xxx $key = 'abc'; print "Key is: '$key'\n"; $ perl xxx Key is: 'abc' $

    I hope this is useful.

    Cheers,

    JohnGG

Re^2: Simple Hash Question
by BlenderHead (Novice) on Nov 18, 2009 at 22:19 UTC

    Heh... Am sorry guys...

    Thank you for your help. :) It solved the problem.

    As per reading the manual - I AM reading the manual... I wouldn't be here if I weren't... ;-)