in reply to Re^3: Need to search for a string in a file
in thread Need to search for a string in a file

I thought (hoped) that grep would have the behaviour you described; but even when I use a very unlikely regular expression, perl's memory usage increases at a constant rate.

The rate doesn't appear to differ depending on what regular expression I use, which seems to imply it's not the matches (of which I doubt there are any) filling memory, but just the input from /dev/urandom (which, as you mention, is endless).

The EOL delimiter is probably \n, which should occur in /dev/urandom 1 in 256 times (so long, but not that long).

Replies are listed 'Best First'.
Re^5: Need to search for a string in a file
by aaron_baugher (Curate) on Oct 21, 2011 at 18:36 UTC

    Interesting. Maybe someone who knows how to use the debugger better than I do could try it and see where the memory is going.

    Perhaps the <$fh> syntax only works as I'm thinking when used in scalar context? I do seem to remember reading somewhere (camel book?) that there's some extra magic when it's used in a while loop that it doesn't have otherwise.