Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

darobin (1316)

  (email not shown publicly)

Journal of darobin (1316)

Sunday March 03, 2002
09:01 PM

Long Variable Names

[ #3271 ]

I know it's just silly but it somehow occured to me that Perl might have a limitation on the length of variable names. I did expect it to have one (perhaps for security or simplicity reasons, I must say that my expectations weren't really clear in reporting that part to me). If limitation there was, I thought that it must be high enough not to be a problem (even 256 would be enough) but I do like to know of limits when they exist. In fact, it appears that there is none :) The following:

perl -e 'my $name = "a" x 1_00_000_000; eval "\$$name = 1;"'

simply hogged my system for a minute or so, while its friend with an extra zero died immediately with an "Out of memory" error. I guess that being limited by memory on the size of one's variable names is not much of a problem... For a while, out of boredom (yes I do need to find a job ;) I wondered if the fact that it also affects package names ought to bother those modules that generate fake packages to eval code in (some in the modperl space do that, as well as AxKit's XSP) but quite honestly, unless you have stupidly deep directory trees, I don't see how one could exploit that!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.