Skip to content

Instantly share code, notes, and snippets.

@nicomen
Last active September 10, 2018 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicomen/044d58f7444762412d91e98aae8f84e6 to your computer and use it in GitHub Desktop.
Save nicomen/044d58f7444762412d91e98aae8f84e6 to your computer and use it in GitHub Desktop.
' allowed as package delimiter vs. syntax error, passing a string into foo and correct interpolation
✔ 18:00 /projects/perl-git [ blead | ✚ 14 …2 ] $ perl -wle "package foo'bar; sub lol { print 'lol'; }; foo'bar::lol()"
lol
✔ 18:00 /projects/perl-git [ blead | ✚ 14 …2 ] $ ./perl -wle "package foo'bar; sub lol { print 'lol'; }; foo'bar::lol()"
Bareword found where operator expected at -e line 1, near "'bar; sub lol { print 'lol"
(Missing operator before lol?)
Unquoted string "lol" may clash with future reserved word at -e line 1.
String found where operator expected at -e line 1, near "lol'; }; foo'"
Bareword found where operator expected at -e line 1, near "'; }; foo'bar::lol"
(Missing operator before bar::lol?)
Invalid version format (non-numeric data) at -e line 1, near "package foo"
syntax error at -e line 1, near "package foo'bar; sub lol { print '"
Execution of -e aborted due to compilation errors.
$ ./perl -wle "sub foo { print 'yay,' . shift; }; foo'bar';";
yay,bar
$ ./perl -wle "my \$foo = q{bar}; print qq{\$foo's}";
bar's
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment