gasho has asked for the wisdom of the Perl Monks concerning the following question:
I have file that is one long line. Pattern looks like:
somecharSTARTfvENDsomecharSTARTsvENDsomecharSTARTtvENDsomechar
I would like to extract all values between START END
so my @Result should be @Result= qw(fv sv tv)
My sub is extracting only first and last finding :(
Thanks in advance Gashosub getInfoFromLongLine { #Openning file for reading open(IFH,"$InputFile") || die "Can't open file: $InputFile\n"; while($line=<IFH>) { if ($line=~/.*START(.*?)END/) { push(@Result,$1); } if ($line=~/.*?START(.*?)END/) { push(@Result,$1); } } return @Result; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to deal with long line
by GrandFather (Saint) on Sep 27, 2005 at 20:50 UTC | |
by gasho (Beadle) on Sep 28, 2005 at 13:09 UTC | |
Re: How to deal with long line
by philcrow (Priest) on Sep 27, 2005 at 21:04 UTC | |
Re: How to deal with long line
by chester (Hermit) on Sep 27, 2005 at 20:47 UTC |
Back to
Seekers of Perl Wisdom