PerlGrok has asked for the wisdom of the Perl Monks concerning the following question:
Simply, I need to extract a the lines between two 'delimiters' if you will and save the extractions as separate files. The formating of the lines needs to stay in place and such. I found the dotdot (..) and dotdotdot (...) operator in the Cookbook thats finding the area right but I'm lost on capturing the match.
Eg. Input file is like this: The "===" is the delimiter. ================================\n some buncha formatted ascii text\n some buncha formatted ascii text\n some buncha formatted ascii text\n ================================\n second buncha formatted ascii text\n second buncha formatted ascii text\n second buncha formatted ascii text\n ================================\n
I was doing something like this
while(<ARGV>){ next unless ($_ =~ /$delimiter/) #look for the === push (@record, $_) #make a temp array &saveRecord(@record) #call the save sub } or while(<ARGV>){ next unless /$delimiter/ ... /delimiter/ while(#something){ push ... }
Anyways Im lost on how to grab up just the stuff between the delimiters, count em and save em...
Thanks in advance!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Range Operator Mysteries
by cephas (Pilgrim) on Dec 01, 2000 at 04:47 UTC | |
|
Re: Range Operator Mysteries
by repson (Chaplain) on Dec 01, 2000 at 05:09 UTC | |
|
Re: Range Operator Mysteries
by mrmick (Curate) on Dec 01, 2000 at 08:14 UTC | |
|
Re: Range Operator Mysteries
by DrManhattan (Chaplain) on Dec 01, 2000 at 09:26 UTC | |
|
Re: Range Operator Mysteries
by jaymoo (Novice) on Dec 01, 2000 at 10:39 UTC | |
|
Re: Range Operator Mysteries
by jeroenes (Priest) on Dec 01, 2000 at 18:04 UTC | |
by chipmunk (Parson) on Dec 01, 2000 at 20:25 UTC |