From: "Greg London" <[email protected]>
Date: Tue, 5 Feb 2013 17:12:05 -0600
Well, this is somewhat disappointing . . .
. . .
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 . . .
The problem is the granularity of caller() line numbers, which use the
first line number of the enclosing statement:
rogers@rgr> tail -3 test.pl
our @array;
push(@array, mysub('a'));
push(@array, mysub('b'));
rogers@rgr> perl test.pl
linenum is '11'
linenum is '12'
rogers@rgr>
Surely you've noticed this in error messages about multiline
expressions?
-- Bob
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm