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

Definitely. It isn't confusing at all though. Perl ignores whitespace. That's actually all you need to know.
my # token $ # token x # token = # token "1" # token ; # token # statement detected!!
I've seen people do things like this from time to time...  $ var -> x [ 4 ] = 3 ;. The feel a bit stuttering to me, but some people like all that extra space.

-Paul

Replies are listed 'Best First'.
Re^2: Is space supposed to be ignored between a sigil and its variable name?
by almut (Canon) on Apr 18, 2009 at 12:04 UTC
    Perl ignores whitespace.

    ...except where it doesn't :)

    Like for example in  < $fh >  vs.  <$fh>.  Or even in <$ fh> — to keep it on-topic.

      Yeah, I suspect the perl toeknizer turns <$fh> into a single token... probably historical, since it always used to be <BLARG> and <> also does <stuff.*> ... so yeah, fine except where it doesn't work -- like way too much overloaded operators?

      -Paul

        context rich enviroment :)
        <$fh> readline$fh < $fh > <$ fh> glob$fh
        you want space, use glob :)
Re^2: Is space supposed to be ignored between a sigil and its variable name?
by ruzam (Curate) on Apr 18, 2009 at 16:51 UTC

    Sure it's confusing. Without running the code, tell me what $i and $j are.

    my $x = ['a', 'b', 'c', 'd', 'e']; my $i = $ x -> [ 4 ]; my $j = "$ x -> [ 4 ]"; print "$i\n"; print "$j\n";
      No :) some things aren't defined well, stick to what is defined :)
      my $x = ['a', 'b', 'c', 'd', 'e']; my $i = $ x -> [ 4 ]; my $j = "$ x -> [ 4 ]"; my $k = "$x->[4]"; warn $i; warn $j; warn $k; __END__ e at - line 6. ARRAY(0x225f04) -> [ 4 ] at - line 7. e at - line 8.