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:

sub dienice { my $line= (caller)[2]; dienicely( "Line $line: ", @_ ); }

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
RE: (tye)RE: current array index( Adam: Exactly )
by Adam (Vicar) on Nov 04, 2000 at 00:37 UTC
    Exactly.
RE: (tye)RE: current array index
by jptxs (Curate) on Nov 04, 2000 at 06:27 UTC

    AHHH! now I see what was meant... silly me.

    caller makes sense now too.

    Man. you guys rule. I learn from books, but sometimes I miss things like this until people show me - it's just the way I learn. Thanks so much.

    "sometimes when you make a request for the head you don't
    want the big, fat body...don't you go snickering."
                                             -- Nathan Torkington UoP2K a.k.a gnat