in reply to Re: Is space supposed to be ignored between a sigil and its variable name?
in thread Is space supposed to be ignored between a sigil and its variable name?
perl ignores whitespaceNo it doesn't. If that where true, then there wouldn't be any difference between:
and$foo =~ /bar/;
the latter not only does not compile, but the spaces inside // are significant, and while =~ is one token, = ~ are two. With a different meaning.$ f o o = ~ / b a r /;
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.
|
|---|