Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1033982]
help
Chatterbox?
[Lady_Aleena]: atcroft, the whole link thing might be a question for either or both the CPAN sites. search.cpan is cpansearch@perl. org, and metacpan doesn't have an email addy for the website itself.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2017-05-27 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?