in reply to __FILE__ and __LINE__ for Perl?

If you're interested in emitting warnings with filenames and line numbers, you might want warn(), which is documented in perlfunc.
warn "I'm a warning about something";
will produce
I'm a warning about something at demo.pl line 47.

die() does the same, but stops execution (unless caught in an exception handler).

Replies are listed 'Best First'.
Re: Re: __FILE__ and __LINE__ for Perl?
by bm (Hermit) on Oct 03, 2003 at 12:02 UTC
    Just to be a little more specific, note that
    warn "I'm a warning about something";
    does not contain a trailing newline. If your warning message does contain \n as the last character, warn will not include at demo.pl line 47. See perldoc -f warn

    --
    bm