Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^4: Need to search for a string in a file

by anneli (Pilgrim)
on Oct 20, 2011 at 23:07 UTC ( #932784=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://932784]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2022-05-20 22:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (76 votes). Check out past polls.

    Notices?