Yes, you can use tell, seek, and read easily on a file handle. But you can't use a regular expression on a file handle so you need a major change to your approach.
How big are the files? Perl uses lots of memory for most things, so reading even a moderately large file into memory probably isn't go to make much of a difference on memory usage.
In any case, you're going to have to read in a big chunk of the file into a string (say $str) so that you can match a regular expression against that chunk. If you use ($str =~ m/.../g), then you can use $pos= pos($str) to see where you currently are in the string and pos($str)= $newpos to change where in the string to start matching against.
-
tye
(but my friends call me "Tye")
|