Please remember to "use strict;" and "use warnings;". I reproduced the error "Modification of a read-only value" based on the incomplete code fragments you provided by commenting out "use strict;". Once you apply strict you get a more informative message that might have avoided this post.
use strict; use warnings; my $d = 3; sub foo { my ($data) = @_; $$data++; } eval {foo($d);}; print $@; # prints informative message provided by strict foo(\$d); print "$d\n"; __END__ Can't use string ("3") as a SCALAR ref while "strict refs" in use ... 4
In reply to Re: Modifying passed-in variables
by mr_ron
in thread Modifying passed-in variables
by mike65535
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |