in reply to At which line number did the print statement occure?

print 'This is line ', __LINE__;
--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re^2: At which line number did the print statement occure?
by monarch (Priest) on Oct 13, 2006 at 13:26 UTC
    Another good one to remember is __FILE__.
      or $0
      Do you know where are all the __LINE__, __FILE__ or __PACKAGE__ documented ?

      Thnx!

        $0 and __FILE__ are subtly different. $0 will only ever contain the name of the program that is running. If the program calls code in other files (modules, for example) then __FILE__ will have different values.

        These values are documented in the section on "Special Literals" in perldata.

        --
        <http://dave.org.uk>

        "The first rule of Perl club is you do not talk about Perl club."
        -- Chip Salzenberg

        man perldata, which, unless you know much about the Perl internals, is an unlikely place to look. I had to use grep on the POD directory to find it.