develooper Front page | perl.perl5.porters | Postings from October 2010

[perl #7767] interpolated BEGIN oddities

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
October 10, 2010 16:49
Subject:
[perl #7767] interpolated BEGIN oddities
Message ID:
rt-3.6.HEAD-6656-1286754563-640.7767-15-0@perl.org
On Sat Sep 29 22:56:04 2001, hv@crypt.compulink.co.uk wrote:
> Under perls at least from 5.005_03 to blead@12163, I get this oddity:
> 
>   crypt% ./perl  -wle 'print qq;@{[ BEGIN { print "BEGIN" } ]};'
>   BEGIN
>   Can't call method "BEGIN" without a package or object reference at
> -e line 1.
>   crypt%
> 
> .. which I think I've seen mentioned recently, but I couldn't find
> back.

BEGIN {} is a subroutine declaration, so I do not find in surprising
that it would not parse as such in an expression. do { BEGIN {}} works.



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About