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

I do this fairly often...

$x = 1; while(<IN>) { # code ... $x ++; }

I'm curious. Sometimes when a perl app dies, it prints the linenumber of the error and also the line number I was at in the IN file.

Is there a __LINE__ style internal that I can use to skip the $x++?

Replies are listed 'Best First'.
Re: file line
by Nkuvu (Priest) on Mar 20, 2003 at 16:59 UTC
    You can just refer to the special variable $. to get the current input line. Is that what you're looking for?
      Ahhh, that's it. man perlvar, far far too obvious. Sorry.
Re: file line
by larsen (Parson) on Mar 20, 2003 at 17:00 UTC
    Is there a __LINE__ style internal that I can use to skip the $x++?

    Sure. Search in perlvar for $.

Re: file line
by Zaxo (Archbishop) on Mar 20, 2003 at 17:00 UTC

    See $. in perlvar. It keeps track of just that.

    After Compline,
    Zaxo