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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.