in reply to Re: use strict refs unless you can't figure out the syntax
in thread use strict refs unless you can't figure out the syntax
I must admit I'm confused by the intent of theleftsock (who seems to have chosen a very complicated way to do a fairly simple thing), but I'm also confused by the intent of the extra lexical scalar $returned_hash_ref present in your reply. What does this give you (other than another maintenance worry) that you do not get from the hash and key you already have in hand?
>perl -wMstrict -le "sub S { print 'hi ', $_[0] } sub T { print 'lo ', $_[0] } sub U { print '-- ', $_[0] } my %hash = ( my $x = L => \&S, my $y = M => \&T, my $z = N => \&U, ); print $x; $hash{$x}->($x); $hash{L} ->('L'); $hash{$_}->($_) for qw(L M N); " L hi L hi L hi L lo M -- N
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: use strict refs unless you can't figure out the syntax
by theleftsock (Beadle) on Jan 08, 2010 at 05:01 UTC | |
by GrandFather (Saint) on Jan 08, 2010 at 08:28 UTC | |
|
Re^3: use strict refs unless you can't figure out the syntax
by GrandFather (Saint) on Jan 08, 2010 at 07:58 UTC |