Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: split at '- - -'

by hdb (Prior)
on May 17, 2013 at 14:00 UTC ( #1033982=note: print w/ replies, xml ) Need Help??


in reply to Re: split at '- - -'
in thread split at '- - -'

As a small variant, there could also be a hybrid case where you want to split on "---" if they are on a line by themselves but not if they occur within a line. Adapting Peter's code:

#!/usr/bin/perl -w use strict; use Data::Dumper; my $line; { local $/ = undef; $line=<DATA>; } chomp $line; my @f = split('\n---\n',$line); print Dumper(\@f); __END__ line1 --- line2---line2a --- line3


Comment on Re^2: split at '- - -'
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2015-07-08 01:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls