abubacker has asked for the wisdom of the Perl Monks concerning the following question:

Dear all ,
I want to know the working principle of the die function when I give

die "Error" ;
will print Error with some additional information like line no
but when I give
die "Error\n" ;

it doesn't print that additional information
why this is happening like this !
Please help me out!

Replies are listed 'Best First'.
Re: die function
by ikegami (Patriarch) on Aug 18, 2009 at 07:06 UTC
Re: die function
by james2vegas (Chaplain) on Aug 18, 2009 at 08:18 UTC
    This is documented in 'die' in perldoc,
    If the last element of LIST does not end in a newline, the current script line number and input line number (if any) are also printed, and a newline is supplied.
    i.e., this is expected and documented, that is why it is happening.
Re: die function
by si_lence (Deacon) on Aug 18, 2009 at 07:09 UTC
    I don't know why this is happening, but it's right in the documentation for die
    If the last element of LIST does not end in a newline, the current script line number and input line number (if any) are also printed, and a newline is supplied.
    cheers, si_lence
Re: die function
by Anonymous Monk on Aug 18, 2009 at 07:15 UTC