Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Searching in binary files

by jdporter (Paladin)
on Dec 14, 2005 at 18:05 UTC ( [id://516711]=note: print w/replies, xml ) Need Help??


in reply to Searching in binary files

You could do this:

local $/ = "find this string"; while (<FILE>) { if ( chomp ) { # you know you found an occurrence } }

We're building the house of the future together.

Replies are listed 'Best First'.
Re^2: Searching in binary files
by graff (Chancellor) on Dec 15, 2005 at 06:47 UTC
    That is rather a nice idea, except: whether one really could do this depends on file size, and whether the process happens to reach either the target string or end-of-file before it runs out of memory.
Re^2: Searching in binary files
by crenz (Priest) on Dec 15, 2005 at 07:45 UTC

    That looks rather nice -- but unfortunately, it is rather slow also... I'm dealing with files that could potentially be hundreds of megabytes in size.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-18 03:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found