Joanne Fearon wrote:
> 
> Hi,

Hello,

> I have a file that I am chopping and changing. I want to delete line 12
> each time. I have a counter to tell the line number. Ive tried
> 
> if ($counter == 12)
>         {
>         next;
>         }
> $counter++
> 
> this doesn't give an error but doesnt move on to the next line either.


If you are reading from a file then the variable $. will contain the
current line number (explained in the perlvar document.)

while ( <FILE> ) {
    next if $. == 12;
    # do other stuff
    }


If you want to use your own counter then:

my $counter;
while ( <FILE> ) {
    next if ++$counter == 12;
    # do other stuff
    }


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to