in reply to Is space supposed to be ignored between a sigil and its variable name?

As others have said elsewhere on this thread, perl ignores whitespace - if you've ever used perltidy on a script/module containing sub attributes, by default, it [perltidy] reformats sub :Attribute name {... to read sub : Attribute name {... i.e. positively inserts whitespace either side of the attribute sigil (':') if that's what it is ;-)

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: Is space supposed to be ignored between a sigil and its variable name?
by JavaFan (Canon) on Apr 19, 2009 at 20:04 UTC
    perl ignores whitespace
    No it doesn't. If that where true, then there wouldn't be any difference between:
    $foo =~ /bar/;
    and
    $ f o o = ~ / b a r /;
    the latter not only does not compile, but the spaces inside // are significant, and while =~ is one token, = ~ are two. With a different meaning.

    The reason that there is optional whitespace after the sigil is a left over from perl4. And probably has to do with the sigil and the variable name lexed as different tokens. And in almost all cases, Perl allows whitespace between tokens.

    Now, in Perl6, the sigil is actually part of the variable name. Hence, '$foo' is a single token. And hence, no whitespace allowed between the sigil and the name.