Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Perl program to search files

by vr (Curate)
on Dec 26, 2018 at 12:12 UTC ( #1227708=note: print w/replies, xml ) Need Help??


in reply to Re: Perl program to search files
in thread Perl program to search files

Minor note:

A typical solution to this kind of problem would be to implement a sliding window

But he is trying to slide:

$START += $BUFF_SIZE - length($FIND);

Unfortunately, it seems that his 4th argument to read is understood as "offset into file", while, of course, it is "offset into buffer". If this

read $F, $BUFFER, $BUFF_SIZE, $START;

is replaced with

seek $F, $START, 0; read $F, $BUFFER, $BUFF_SIZE;

then his sliding window works.

Replies are listed 'Best First'.
Re^3: Perl program to search files
by haukex (Bishop) on Dec 26, 2018 at 12:47 UTC
    But he is trying to slide

    Ah, you are correct, thank you!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2020-12-03 20:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (57 votes). Check out past polls.

    Notices?