in reply to Guess, what following simple oneliner print:

baz'foo is a depreceated way of refferring to name spaces/hiearchys, they probably get translated into ::'s by the compiler someplace, then the => stringifies it.
  • Comment on Re: Guess, what following simple oneliner print:

Replies are listed 'Best First'.
Re: Re: Guess, what following simple oneliner print:
by Anonymous Monk on Jul 22, 2002 at 07:56 UTC
    ... but why didn't stringification came first?
      BUU and moxliukas are spot on with regards to the ' being the old package delimiter - However with regards to the => operator and the quotes, the use of this operator is synonymous with the comma operator which in the scalar context, evaluates the left argument. This means that the This'is'it code is evaluated prior to being printed within the interpolated quotation marks.

      For a further explanation on this, see perlop under the heading "Comma Operator".

       

        However with regards to the => operator and the quotes, the use of this operator is synonymous with the comma operator which in the scalar context, evaluates the left argument.

        But print allways uses list context. So print doesn't get the string 'This::is::it', but a list consisting of  'This::is::it', '', '', which still evaluates to 'This::is::it'

        Try this:

        perl -we "print test'bla=>$/"

        You'll see that the value of $/ will be printed, as => is just another comma operator, so the above is the same as

        perl -we "print test'bla,$/"

        You can pack in even more commas:

        perl -we "print test'bla=>=>=>=>=>''"

        (BTW, I've been using the single-quote-as-package-delimiter trick for quite some time in my .sig>

        -- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
    A reply falls below the community's threshold of quality. You may see it by logging in.