Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^2: AI Overlords

by hippo (Canon)
on Mar 10, 2016 at 00:17 UTC ( #1157237=note: print w/replies, xml ) Need Help??

in reply to Re: AI Overlords
in thread AI Overlords

So amazingly only the last line actually produces an error

Without semicolons this is all just one statement. The single statement has a lot of commas which IIRC are evaluated from right to left and therefore the last line of the prose is the first phrase that perl will actually try to parse in any detail.

Replies are listed 'Best First'.
Re^3: AI Overlords
by morgon (Curate) on Mar 10, 2016 at 00:23 UTC
    I was surprised that it would not bail out at the full-stops.

    Is there any way to see how perl attempts to parse a script that eventually turns out not to be valid (B::Deparse will not help then I suppose...)

      I was surprised that it would not bail out at the full-stops.

      The full stop is the concatenation operator. This is valid perl:

      $ perl -ce 'a . b;' -e syntax OK

      If your only punctuation is the full stop and the comma you can get away with most things. Just avoid reserved words near punctuation.

      $ perl -ce 'Twas brillig, and the slithy toves Did gyre and gimble in +the wabe; All mimsy were the borogoves, And the mome raths outgrabe' -e syntax OK

      Of course, you couldn't end that with a full stop because it's a binary operator. HTH

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1157237]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2018-07-20 11:13 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (429 votes). Check out past polls.