in reply to Unexpected parsing

This is fine:

c:\test>perl -MO=Deparse -e "my $c; 1 ? $c : my( $d ); $d" my $c; $c; $d; -e syntax OK

In your version, it's trying to parse an attribute--like $c :shared


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

Replies are listed 'Best First'.
Re^2: Unexpected parsing
by JadeNB (Chaplain) on Dec 16, 2009 at 08:06 UTC
    In your version, it's trying to parse an attribute--like $c :shared
    I figured out from the error message what was happening with the parsing, but couldn't tell what was different about the 2 cases involving my $c that made them parse differently. I have updated my post with a guess (that it's the whitespace-plus-alphanumeric after the colon), but I'm not sure whether this is the desired behaviour or a bug (or my guess is wrong!).