in reply to How to pass by reference

Just put a backslash in front of the dollar-sign when you pass the variable to the function.

Don't forget to de-reference the variable inside the function ...

use strict; use warnings; my $x = 10; &function( \$x ); # if I change $x = 5 print $x; # $x = 10 sub function { my $x = $_[0]; $$x = 5; } # End function subroutine

--
-- Ghodmode
Blessed is he who has found his work; let him ask no other blessedness.
-- Thomas Carlyle