> On 1/10/07, Peter Scott <[EMAIL PROTECTED]> wrote:
> > On Wed, 10 Jan 2007 07:37:24 -0500, Muttley Meen wrote:
> > > I have the code:
> > >
> > > $SIG{__WARN__} = sub { print $_[0]; } ;
> > >
> >
> > perldoc -f die
> >
> > (perldoc -f warn should probably be clearer on this.)
> >
> Already did that :)
> 
> >
> > $SIG{__WARN__} = sub { my $msg = shift; chomp $msg; print 
> "$msg\n"; } ;
> 
> How is this different from what I wrote above ?

The extra "\n"?

[EMAIL PROTECTED]:~ 04:28 PM]$ perl -e 'use warnings; use strict; $SIG{__WARN__}
= sub { print $_[0]; } ; warn "OH NO!";'
OH NO! at -e line 1.
[EMAIL PROTECTED]:~ 04:28 PM]$ perl -e 'use warnings; use strict; $SIG{__WARN__}
= sub { print $_[0]; } ; warn "OH NO!\n";'
OH NO!


>From perldoc -f die:

<snip>

               If the last element of LIST does not end in a newline,
the cur-
               rent script line number and input line number (if any)
are also
               printed, and a newline is supplied.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to