in reply to RE: RE: current array index
in thread current array index
If you put a literal __LINE__ in the output (but not inside quotes), then it will be replaced with the line number of the output file, which appears to be what you want. For example, your final output would look like:
dienice("Line ",__LINE__,": oops\n");
Alternately, you could use caller inside your dienice() routine. It would give you the line number of where dienice() was called from so you could prepend it to the message and wouldn't have to rewrite the calls to dienice(). For example:
- tye (but my friends call me "Tye")sub dienice { my $line= (caller)[2]; dienicely( "Line $line: ", @_ ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: (tye)RE: current array index( Adam: Exactly )
by Adam (Vicar) on Nov 04, 2000 at 00:37 UTC | |
|
RE: (tye)RE: current array index
by jptxs (Curate) on Nov 04, 2000 at 06:27 UTC |