in reply to Problems to use strict with dynamic $$variable
With use strict you get use strict 'refs' which specifically prohibits the symbolic references you are trying to use in the case of 'L0'. You need to either use hard references or insert "no strict 'refs'" before you use a symbolic reference. The prohibition of symbolic references under strict is there for a purpose, so you need a good reason to do the second option. See strict and perlref for details.
use strict 'refs'; my $foo = "bar"; # hard reference my $ref = \$foo; print $$ref; # ok, prints "bar" # symbolic reference $ref = "foo"; print $$ref; # runtime error; ok without strict { no strict 'refs' print $$ref; # works but considered bad }
The symbolic reference generates runtime error in the first instance. We enclose the no strict 'refs' in a bare block to limit its scope to the one line where we want to use a use a sym ref. This is the best way to do this if you absolutely positively can not live without a sym ref. 99+% of the time you can and should avoid sym refs.
Your second error occurs because you are trying to declare a dereference $$lentry. You need to declare the variable $lentry, assign a reference to it, and then dereference it using $$lentry. $$lentry is not something that you declare.
tachyon
|
|---|