Oh my, you appear to be correct.

The parser seems to have a hardcoded limitation of 256 characters. This runs fine:

C:\test>perl -E"$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1 = 1"

But add 1 more x and it stops with:

C:\test>perl -E"$xxxxxxxxxxxxxxxxx Identifier too long at -e line 1.

or just traps or both. But the limitation (static buffer or hardcoded length?) is only in the parser, the rest of perl handles longer fine. What I did to verify my assertion above (before making it) was:

$longName = 'x' x 1e4;; ${ $longName . 1 } = 1;; ${ $longName . 2 } = 2;; if( ${ $longName . 1 } != ${ $longName . 2 } ) { print 'Great! Ten thousand characters long and all significant.' };; Great! Ten thousand characters long and all significant.

I knew there was some limitation, because when I tried for a hundred thousand(*) it bellyached about something being readonly. But as far as I'm concerned, 10,000 is for all practical purposes, unlimited.

I've encountered one or two authors that insisted in detailing their life, work or academic career histories into their comments; but never a novella in a variable name :)

(*)Update: Or maybe I just typoed because I've now succeeded in creating variable with a million (and one) significant characters...


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW

In reply to Re^3: PERL Variable Name, Significant length by BrowserUk
in thread PERL Variable Name, Significant length by robo_kevs_009

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.