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; }
Back to
Seekers of Perl Wisdom