here's a challenge for you
i am trying to find a way to do something pretty complicated. it's really
not all that hard the way i did it but it's pretty hard to do well. what
i've done in my function is taken a huge slurped text file and an array of
regexs. i match each regex and which ever gives me the largest amount text
remaining, i use. what i need to do is read the textfile more efficiently
(probabbly <STDIN>) and not keep it in memory, and i need to check the
regexes matching altogether, not each seperatly in a loop for efficiency's
sake. the regexs are basically racing to see who can match the <STDIN>
first. like this although getc() is very inefficient. i probablly need to
do it with <> in a scalar context...
while ($stream .= getc()) {
if (any of my regex's match yet)
return (the regex);
}
return 'nothing matched';
#end
the position i am at in STDIN is saved over calls
to this function, so i can simply call it, get some
matched text, then call it again with the same
array of regex's and it should give me different matched
text, cause what was matched before is now gone.
thanks to anyone with any info. any directing me to something written on
the subject or even a few scratches of pseudo code would be appreciated.
-mike
X=8!