in reply to Re: Trying to automate some scalar assignments
in thread Trying to automate some scalar assignments

Oh come on...if you're going to muck with symbolic references, let's muck with symbolic references (and the symbol table) (-:
my %hash = (a => 1, b => 2, c => 3, d => 4); for (keys %hash) { *$_ = \$hash{$_}; } $hash{c} = "foobar"; print "$c\n";
(Caveat: This does not use 'my' variables, but then, the OP didn't say that they were required)

Replies are listed 'Best First'.
Re^3: Trying to automate some scalar assignments
by davido (Cardinal) on Sep 22, 2011 at 21:05 UTC

    Well that's run-of-the-mill evil. :)

    I did consider the global symbol table, but the first line of sample code provided by the OP was, "my($a, $b, $c, $d);", so I assumed he really was trying to manipulate lexicals symbolically. Either way we're both going to need to wash our hands in hot water with pumice soap now.


    Dave

      Awesome, folks, thanks!