Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Answer: How do I delete/modify one line from test file ?

by draco_iii (Acolyte)
on Jun 22, 2000 at 22:18 UTC ( #19479=categorized answer: print w/replies, xml ) Need Help??

Q&A > files > How do I delete/modify one line from test file ? - Answer contributed by draco_iii

open(FILEHANDLE,"+< $FILENAME) or die print $!; while(<FILEHANDLE>){ if ($_ ne 'b|b|b|b|b|b'){ push(@outtext,$_); } Do what you want from here. Of course it always a good idea to lock the file if you are on a UNIX system.

Replies are listed 'Best First'.
Re: Answer: How do I delete/modify one line from test file ?
by Anonymous Monk on Apr 04, 2001 at 01:07 UTC
    I can't get that to work how. Could you post a more complete answer. I am feeding the push command the line that I want removed but it doesn't do anything. What am I doing wrong?

      well, if you're pushing the line you don't want onto the array, it's going to end up in the array. It might help to think of another way of doing the same thing:

      push @array, $line unless $line eq 'b|b';

      Read the fine manual! => perldoc -f push

      Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Log In?

What's my password?
Create A New User
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-06-19 06:53 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.