New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perl -e '#!perl -s' is weird #11836
Comments
From @cpansproutThe subject can be understood in both senses. :-) Running perl with -e '#!perl -s' results in erratic behaviour. Normally, @ARGV begins with the first argument that perl itself does not interpret: $ perl -le 'print("@ARGV")' 1 But -e '#!perl -s' causes the argument to a subsequent -e to be included in @ARGV magically: $ perl -le '#!perl -s' -e 'print("@ARGV")' 1 Even including switches like -w that perl itself is interpreting: $ perl -le '#!perl -s' -e 'print("@ARGV"); 3' -w a Unless the argument to -e is part of the same command-line argument: $ perl -le '#!perl -s' -e'print("@ARGV");' -w Those ‘used once’ warning suggest that -s is parsing the switches to perl itself. And then perl is parsing them, too. Let’s see: $ perl -le '#!perl -s' -e'$a += 1; print ${"e\$a +"};' I wonder if I could write a quine with this. :-) Flags: Site configuration information for perl 5.15.6: Configured by sprout at Thu Dec 29 12:39:18 PST 2011. Summary of my perl5 (revision 5 version 15 subversion 6) configuration: Locally applied patches: @INC for perl 5.15.6: Environment for perl 5.15.6: |
From @cpansproutOn Sun Jan 01 13:12:30 2012, sprout wrote:
perl -le '#!perl -s' -e'$a=1;print+"perl -le \x27#!perl -s\x27 -- Father Chrysostomos |
The RT System itself - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#107368 (status was 'open')
Searchable as RT107368$
The text was updated successfully, but these errors were encountered: