in reply to Syntax Explanation Please

Running it through B::Deparse reveals that you're close:

perl -MO=Deparse -e '$foo = "blarny!"; print $foo.bar.baz.quux;'

yields:

$foo = 'blarny!'; print $foo . 'bar' . 'baz' . 'quux'; -e syntax OK

And prints "blarny!barbazquux".

Replies are listed 'Best First'.
Re: Re: Syntax Explanation PLs
by submersible_toaster (Chaplain) on Jan 07, 2003 at 07:01 UTC

    /me makes mental note to investigate B::Deparse sometime soon. Interestingly enough, and this is now way beyond useful.

    $foo = 'hmmm'; bar = 'why?'; print $foo.bar.me
    Deparses as
    $foo = 'grrr'; do bar = 'why?'; print $foo . 'bar' . 'me';
    Of course they break in different ways. do bar = 'why?' dies with a compilation error. Can't modify do "file" in scalar assignment
    bar = 'why?' Gets through with a warning, but when used with . results in a error : Undefined subroutine &main::bar.
    My presumption is 'bar=' does something ugly to the symbol table - and why not? its pretty cruel use of syntax, sadly it's also an easy typo.

    use strict #or die screaming.$!