choroba has asked for the wisdom of the Perl Monks concerning the following question:
(1) $ perl -MO=Deparse -e 'do("foo")->{bar};' do $foo{'bar'}; -e syntax OK (2) $ perl -MO=Deparse -e '(do "foo")->{bar};' do('foo')->{'bar'}; -e syntax OK (3) $ perl -MO=Deparse -Mstrict -e 'do("foo")->{bar};' Global symbol "%foo" requires explicit package name at -e line 1. -e had compilation errors. use strict 'refs'; do $<none>::foo{'bar'}; ERROR CODE: [34] (4) $ perl -MO=Deparse -Mstrict -e '(do "foo")->{bar};' use strict 'refs'; do('foo')->{'bar'}; -e syntax OK
So, (2) deparses to (1). (3) is not permitted under strict. (4) is permitted, but deparses to (3). What's going on here? (v5.14.4 under cygwin)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: B::Deparse weirdness (parser weirdness!)
by LanX (Saint) on Oct 13, 2014 at 11:35 UTC | |
by LanX (Saint) on Oct 13, 2014 at 12:42 UTC | |
by LanX (Saint) on Oct 13, 2014 at 23:09 UTC | |
|
Re: B::Deparse weirdness (updated)
by LanX (Saint) on Oct 13, 2014 at 11:06 UTC |