http://www.perlmonks.org?node_id=495517


in reply to symbolic references

Here's another way. The "foreach" statement automatically aliases the loop variable to the items in the list, so you could just do:
use strict; my $varA = "this is varA"; my $varB = "this is varB"; my $varC; print "\n"; foreach my $f ($varA, $varB, $varC) { if ( defined $f ) { print "--- $f \n"; my $tmp = $f . " and some more "; print "----- $tmp \n"; $f = $tmp; print "===== $f \n"; } } print "\n"; foreach my $f ( $varA, $varB, $varC ) { print "+ $f \n"; } print "\n";