Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Delete line if REGEX == true

by neniro (Priest)
on Aug 07, 2005 at 09:35 UTC ( #481648=note: print w/replies, xml ) Need Help??


in reply to Delete line if REGEX == true

Another way to directly remove unwanted lines is using Tie::File and greping those lines you want:
#!/usr/bin/perl use strict; use warnings; use Tie::File; my @text; tie @text, 'Tie::File', 'test_filter.txt' or die "Something went wrong: $!\n"; @text = grep { !/,,,,,/ } @text; untie @text; exit;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://481648]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2023-02-08 07:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (40 votes). Check out past polls.

    Notices?