Skip to content

Instantly share code, notes, and snippets.

@exodist
Created February 18, 2016 18:37
Show Gist options
  • Save exodist/afffae9db1f7b6ed13b9 to your computer and use it in GitHub Desktop.
Save exodist/afffae9db1f7b6ed13b9 to your computer and use it in GitHub Desktop.
caller woes
use strict;
use warnings;
my ($line1, $line2, $line3);
sub foo {
(undef, undef, $line1) = caller(0);
}
$line2 = __LINE__ + 1;
foo(
'f23' => {
active => 0,
custom => sub { 1 },
notify_on => 0,
notify_for => 'active',
},
);
$line3 = __LINE__ - 1;
print "$line1 - $line2 - $line3\n";
__END__
$ perl test.pl
15 - 11 - 18
WTF?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment