in reply to Re: Re: path is broken
in thread path is broken

Perl keeps track of the line number of the file you are in so you don't have to:
perl -e "while(<>){};print $." somefile.txt
Gotta love that $. variable :)

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: (Ovid) Re(3): path is broken
by btrott (Parson) on Dec 07, 2000 at 00:20 UTC
    I particularly like this code, posted by Abigail on (I believe) comp.lang.perl.misc:
    perl -wlpe '}{*_=*.}{' <file>
(OT) Re: (Ovid) Re(3): path is broken
by marius (Hermit) on Dec 07, 2000 at 01:02 UTC
    There's a lot of $. (<-- that dot is a regex =]) variables to love, yet I've only stumbled across a few of them, and even less explanations of what those variables do. Anyone know of a comprehensive listing of what variables are available to us in the $/./ (<-- that is a correct regex!) format and what they all do? I haven't noticed it in any of my books (I haven't read all of every book yet, so standard disclaimer of "i may be a fool" applies here).

    -marius

      As merlyn is not around I will have to sub and give you the ob. reference:

      perldoc perlvar

      will give you the entire list.