in reply to Very quick question about names in perl

Update:I mis cut and pasted the main link. Perl Documentation:perlvar
and the quote from it but it sums itself up well.

From: Perl Documentation: perldata

Names

Names that start with a digit may contain only more digits. Names that do not start with a letter, underscore, digit or a caret (i.e. a control character) are limited to one character, e.g., $% or $$. (Most of these one character names have a predefined significance to Perl. For instance, $$ is the current process id.)

From: Perl Documentation: perl

Bugs

While none of the built-in data types have any arbitrary size limits (apart from memory size), there are still a few arbitrary limits: a given variable name may not be longer than 251

"No matter where you go, there you are." BB
  • Comment on Re: Very quick question about names in perl

Replies are listed 'Best First'.
Re: Re: Very quick question about names in perl
by hardburn (Abbot) on Dec 15, 2003 at 16:09 UTC

    Unless you're looking up names symbolically, in which case you can put anything in a variable name, including control characters:

    # 007 (octal) is ASCII bell perl -e '${"\00717foo"} = 1; print ${"\00717foo"}'

    Though this should usually not be confused with a good idea.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    : () { :|:& };:

    Note: All code is untested, unless otherwise stated

Re: Re: Very quick question about names in perl
by dakedesu (Scribe) on Dec 15, 2003 at 13:07 UTC

    Thanks--I guess they updated it since 5.6.1 (which I haven't bother to update from the default FreeBSD install)

      If possible, I would upgrade to version 5.8.x -- that's the current version, and one that most folk would assume you are using (unless you say otherwise). The most recent release is here and many other places around and about.

      --t. alex
      Life is short: get busy!

        Will do.

        I've just been procrastinating, because I have been thinking about installing Gentoo (all the cool kids are using it, apparently).