Skip to content

Instantly share code, notes, and snippets.

@exodist
Last active December 8, 2020 19:26
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 exodist/57aba2e754ff11abb1db1c084b2a992c to your computer and use it in GitHub Desktop.
Save exodist/57aba2e754ff11abb1db1c084b2a992c to your computer and use it in GitHub Desktop.
wtf?
exodist@abydos main $ perl -e 'BEGIN { *foo = sub { 512 } }; my $xxx = 16; my $yyy = foo - $xxx; print "$yyy\n";'
512
foo() instead of foo fixes it
exodist@abydos main $ perl -e 'BEGIN { *foo = sub { 512 } }; my $xxx = 16; my $yyy = foo() - $xxx; print "$yyy\n";'
496
using sub() to define foo also fixes it.
exodist@abydos main $ perl -e 'BEGIN { *foo = sub() { 512 } }; my $xxx = 16; my $yyy = foo - $xxx; print "$yyy\n";'
496
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment