in reply to Re^2: Readdir against large number of files
in thread Readdir against large number of files
You're right, I didn't read your original code carefully enough.
You can introduce a variable that stores if it's after the STRUC20 line:
while (my $matchingFiles = glob("*.rtsd001")) { ... my $seen_struct; while (<UNMODIFIED>) { if ($seen_struct || /STRUCT20/) { $seen_struct = 1; print MODIFIED $_; } } ... }
That way you don't have to store all the rest of the lines in memory, and still get the same semantics.
Update: actually this solution looks more elegant, but does nearly the same thing.
|
|---|