If I use : use strict; my script will fail with the following error : Can't use string ("L0") as a SCALAR ref while "strict refs" in use at compgui2.pl line 109. If I declare my $$lentry I got the following error : Can't declare scalar deref in my at compgui2.pl line 29, near "$lentry =" BEGIN not safe after errors--compilation aborted at compgui2.pl line 60. If I don't use strict it works fine. Anybody knows how to get around it and still use strict.
for($i=0;$i<$size;$i++) { if ($size <= 10) { use integer; my $val = $hash{dataParams}->{$keys[$i]}->{val}; my $lentry ='L'.$count; my $$lentry = $W->Label( -text => "$keys[$i]".": $val ", -width => 20, -background => 'white', -foreground => 'black'); Tk::grid($$lentry, -row => $i, -column => 0, -sticky => 'w', -padx => 10, -pady => 10, ); my $closeButton = $W->Button( -text => 'close', -command => [\&exit], -width => 7, -height => 1, ); my $brow = $size + 1; Tk::grid($closeButton, -row => $brow, -column => 0, -sticky => 'w', -padx => 10, -pady => 10, ); }
In reply to Problems to use strict with dynamic $$variable by juo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |