- or download this
# use strict; # UPDATE: that was commented as spotted by Eily
+( see below)
# use warnings; # UPDATE
...
my $test='original value';
print "inside main \@ARGV is [@ARGV] and \$test is [$test]
+\n";
- or download this
perl -s simple.pl -test=SET_VIA_-s arg1
inside BEGIN @ARGV is [arg1] and $test is [SET_VIA_-s]
inside main @ARGV is [arg1] and $test is [original value]
- or download this
perl -MO=Deparse -s simple.pl -test=SET_VIA_-s arg1
inside BEGIN @ARGV is [arg1] and $test is [SET_VIA_-s]
...
my $test = 'original value';
print "inside main \@ARGV is [@ARGV] and \$test is [$test]\n";
simple.pl syntax OK
- or download this
perl -se "BEGIN{print qq(inside BEGIN \@ARGV is [@ARGV]\n)};print
+ qq(inside main \@ARGV is [@ARGV] and \$test is [$test]\n);"
-test=SET_VIA_-s arg1
...
Can't modify constant item in scalar assignment at -e line 2, near
+ "SET_VIA_-s"
syntax error at -e line 2, near "SET_VIA_-s"
Execution of -e aborted due to compilation errors.
- or download this
perl -se "BEGIN{print qq(inside BEGIN \@ARGV is [@ARGV]\n)};print
+ qq(inside main \@ARGV is [@ARGV] and \$test is [$test]\n);"
-- -test=SET_VIA_-s arg1
inside BEGIN @ARGV is [arg1]
inside main @ARGV is [arg1] and $test is [SET_VIA_-s]
- or download this
perl -se "use strict; use warnings;BEGIN{print qq(inside BEGIN \@
+ARGV is [@ARGV]\n)}my $test='originalvalue';print qq(inside main \@
+ARGV is [@ARGV] and \$test is [$test]\n);"
-- -test=SET_VIA_-s arg1
inside BEGIN @ARGV is [arg1]
inside main @ARGV is [arg1] and $test is [original value]
- or download this
perl -se "'A'=~/(A)/;print $1 " -- -1=OUCH!
OUCH!
perl -se "'A'=~/(A)/;print qq($1\n)" -- -1=OUCH!
A