>      while(<logfile>)
>     {
>           #if(#####line I'm currently on is m/$searchstring/i)
>           {
>                print;
>           }
>
> Now the problem is, how do I specify "The line I'm currently working
on"?

That's easy -- you don't.

When you said:

    print;

you didn't specify what to print. So print printed $_,
the default variable. Lots of functions either set or
get the default variable if you don't tell them to do
otherwise.

In the same vein:

    while (<>) {

(with or without a handle name in the <>s)
sets $_.

And:

    if (/foo/) {

compares foo to $_.

Easy, huh?

Btw, the current line no is in $.

hth.

Reply via email to