in reply to __FILE__ and __LINE__ for Perl?

If dws's suggestion of warn w/o trailing "\n" isn't good enough, you might want to look into using caller to get more control:

my $Debugging= ...; sub Trace { return if ! $Debugging; my( $file, $line )= ( caller )[1,2]; warn @_, " at $file:$line\n"; } #... Trace("stupid debug message");

                - tye

Replies are listed 'Best First'.
Re: Re: __FILE__ and __LINE__ for Perl? (caller)
by drewhead (Beadle) on Oct 02, 2003 at 18:54 UTC
    Why not just use Carp here? croak for die and cluck for warn give you errors from the callers perspective without having to do anythign else.
    use Carp; croak "stupid debug message";
      You mean carp instead of cluck (the latter produces a stack trace as well).

      Makeshifts last the longest.