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...
In reply to Re^3: PERL Variable Name, Significant length
by BrowserUk
in thread PERL Variable Name, Significant length
by robo_kevs_009
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |