seek (INPUT, $last, 0)
and:
seek (INPUT, tell (INPUT) - $last, 1);
then tell me which is easier to read and which is easier to maintain (is less complex)? For me the absolute seek is the winner by far.
Drawing an analogy with the way people seek in a book is not particuarly helpful as a model for analysing the pros and cons of the two seek methods by the way. Personally I tend to flip through a book from the back (seek (fh, pos, 2)) then perform a binaryish search from approximately the right place. :)
DWIM is Perl's answer to Gödel
|