in reply to Re: how to "rename" a global argument in subroutine?
in thread how to "rename" a global argument in subroutine?

Thank you for your answer! ...although I'm now having some other issue related..

Does "parsing by reference" make that a symbolic link? Because later when I try to access $red 's value I get the following error.

"Can't use string ("red") as a SCALAR ref while "strict refs"

Would you have any other advice on how I could go about resolving this? Much appreciated.

  • Comment on Re^2: how to "rename" a global argument in subroutine?

Replies are listed 'Best First'.
Re^3: how to "rename" a global argument in subroutine?
by FreeBeerReekingMonk (Deacon) on Aug 11, 2015 at 18:52 UTC

    Yes, a reference is a "symbolic link", to point to the value you need to either use the arrow or typecast it. For example:

    #!/usr/bin/perl use strict; use warnings; my $red = 23; my $also_red = \$red; ${ $also_red } = 12; # typecast to scalar using ${} print "$red is actually $$also_red"; # this also works