in reply to Re^2: search/grep perl/*nix
in thread search/grep perl/*nix

Hi, haukex will provide his own answer no doubt, but: No, the memory footprint should not grow, since

while ( my $line = <$FILEHANDLE> ) { ... }
does *not* slurp the entire file into memory, but reads it one line at a time. See, for example, https://perldoc.perl.org/perlfaq5.html#How-can-I-read-in-an-entire-file-all-at-once%3f for a discussion of the issue.


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^4: search/grep perl/*nix
by Laurent_R (Canon) on Nov 25, 2017 at 18:57 UTC
    The memory footprint may not grow very fast, but it will most probably grow because the %seen hash is very likely to get larger with a bigger file (unless the data input has really many duplicates when the file grows larger).

      Correction accepted; I was thinking only in terms of reading in the file, since in the OP, post-reading data storage seemed to be moot. But you are quite right.

      The way forward always starts with a minimal test.