http://www.perlmonks.org?node_id=201768


in reply to Re: search, replace and backrefrences
in thread search, replace and backrefrences

Well, im not real sure that $1_0_0_ isnt being treated as such.

Variable names that start with a digit may only have
more digits in the name.

This seems a murky area. my $99; throws an error.

This post has little to do with the original question.

Replies are listed 'Best First'.
Re: Re: Re: search, replace and backrefrences
by diotalevi (Canon) on Sep 30, 2002 at 16:56 UTC

    Even with the number formatting semantics where 1_000_000 == 1000000?

      Even with the number formatting semantics where 1_000_000 == 1000000?

      Yes this use of underscores is only for numeric literals.

Re: Re: Re: search, replace and backrefrences
by demerphq (Chancellor) on Sep 30, 2002 at 19:27 UTC
    Variable names that start with a digit may only have more digits in the name.

    Cool. I didnt know that. What perldoc is it in?

    This seems a murky area. my $99; throws an error.

    Well, i agree its weird, but its not that murky. All of the ^\d+$ variables are global only and cannot be my()ed (and all of the scalars are read only).

    --- demerphq
    my friends call me, usually because I'm late....

      I was about to say murky, but unimportant but bit my tongue
      as everything is important to someone.

      It seems unclear what behavior is intended, i.e. murky.
      Why shouldn't I be able to my $99;?   I haven't seen anything to
      suggest it is illegal. Or why is $123456 read-only?

      Is this documented somewhere? Point me at it.

      I'm pretty sure I got that from the Camel book.

        Its partly documented in perlvar but mostly in the camel. Basically all the digit scalars are used for doing pattern match storage. Apparently one of the other scripting langugae had a limit (i think 9) on the number of capture buffers allowed. I believe it was a matter of pride that perl could handle an unbounded number (ykwim). And as all of the capture buffers are read-only that makes them all read only. The lexical bit I dont remember. :-)

        --- demerphq
        my friends call me, usually because I'm late....

        From perldoc perlvar:
        $<digits>
        Contains the subpattern from the corresponding set of parentheses in the last pattern matched, not counting patterns matched in nested blocks that have been exited already. (Mnemonic: like \digits.) These variables are all read-only.

        Cheers,
        Shendal