in reply to Re2: line number
in thread line number
blakem said:$linenum = &{sub{(caller)[2]}};
$linenum = __LINE__;
dmitri's solution returns the line number of the call tothe line in the current subroutine.
blakem's solution returns the line number of the __LINE__ within the current subroutine.
Amended 4:10p PDT I'm not sure why dmitri is building a subroutine reference only to call it. dmitri, do you care to clarify?
At 4:15, after reading blakem's follow-up, I realize blakem is right. dmitri's would be different, if he'd said:
but he didn't. So they are equivalent, and I must say that __LINE__ is much simpler.$linenum = (caller)[2];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re:4: line number
by blakem (Monsignor) on Sep 12, 2002 at 23:09 UTC | |
|
Re: Re: Re2: line number
by dmitri (Priest) on Sep 13, 2002 at 16:17 UTC | |
by blakem (Monsignor) on Sep 14, 2002 at 11:14 UTC |