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


in reply to Way to do a "scalar ref"?

Seems to me that you want to pass a scalar reference:

my $test = "foo bar"; print "Test is now: $test \n"; test(\$test); print "Test is now: $test \n"; sub test { my ( $ref ) = @_; $$ref =~ s/foo/whatever/g; }

Replies are listed 'Best First'.
Re^2: Way to do a "scalar ref"?
by ultranerds (Hermit) on Sep 26, 2011 at 08:59 UTC
    Hi,

    Wahoo, thats the beauty - thanks!

    Andy