echo print join ' ', $0, $R > switch-test.pl
# after the program name
perl -s switch-test.pl -R=OK
switch-test.pl OK
# before an argument of --
perl -s switch-test.pl -R=OK --
switch-test.pl OK
# wrong usage
perl -s switch-test.pl -- -R=OK
switch-test.pl
####
# after the program name
perl -s -e "print join ' ', $0, $R" -R=OK
Unrecognized switch: -R=OK (-h will show valid options).
# before an argument of --
perl -s -e "print join ' ', $0, $R" -R=OK --
Unrecognized switch: -R=OK (-h will show valid options).
# it works in the opposite way of what perlrun states
perl -s -e "print join ' ', $0, $R" -- -R=OK
-e OK
##
##
perl -snwe "print join ' ', $0, $R, $/" -- -R=OK lorem.txt
-e OK
-e OK
-e OK
-e OK
##
##
perl -wse "print join ' ', $0, $R" -- -R=OK
-e OK
perl -swe "print join ' ', $0, $R" -- -R=OK
-e OK
perl -sew "print join ' ', $0, $R" -- -R=OK
#what the hell?! ..no output :)