Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Include Delimiter in Split Output

by jwkrahn (Abbot)
on Jul 30, 2009 at 18:44 UTC ( [id://784701]=note: print w/replies, xml ) Need Help??


in reply to Include Delimiter in Split Output

Perhaps using paragraph mode.   Something like this:

#!/usr/bin/perl #<"SplitFile.pl"> Split File use warnings; use strict; my ( $OPTION, $SEARCH, $FLNAME ) = @ARGV; open XFILE, '<', $FLNAME or die "Couldn't open '$FLNAME': $!\n"; local $/ = ''; # Set paragraph mode while ( <XFILE> ) { if ( $OPTION eq 'with' && /$SEARCH/i ) { print; } elsif ( $OPTION ne 'with' && !/$SEARCH/i ) { print; } }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-29 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found