Line numbers are never reliable in the stack, because its typically the line the statement commenced on. Just pass in __LINE__ for that reason.
Sent from my iPhone On Feb 5, 2013, at 6:12 PM, Greg London <[email protected]> wrote: > Well, this is somewhat disappointing: > > Put this in a file called test.pl > > sub mysub{ > my @callinfo=caller(0); > my $linenum=$callinfo[2]; > print "linenum is '$linenum'\n"; > } > > > our @array=( > mysub('a'), > mysub('b') > ); > > > Then run it and you get something like this: > > perl test.pl > linenum is '10' > linenum is '10' > > > If you change it to > our @array=( > mysub('a', __LINENUM__ ), > mysub('b', __LINENUM__ ) > ); > > You get 11 and 12 passed into the mysub routine. > > Which would be OK I suppose, except perl doesn't have text macros > that I know of. > > argh.... > > Greg > > > > _______________________________________________ > Boston-pm mailing list > [email protected] > http://mail.pm.org/mailman/listinfo/boston-pm _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

