How smart is 'seek $fh, $pos, 0'?by Monk::Thomas (Friar)
|on May 27, 2015 at 12:36 UTC||Need Help??|
Monk::Thomas has asked for the
wisdom of the Perl Monks concerning the following question:
If the filehandle is at position X and I want to go to position Y: Does 'seek $fh, $pos, 0' rewind to the begin and then skip ahead to $pos or does it optimize automatically and just moves from the current position to the intended position?
In other words:
a) Does it actually make a difference if I calculate the difference and use 'seek $fh, $delta, 1' or if I simply use 'seek $fh, $abs, 0'?
b) Is there a difference between going back (Y<X) and skipping ahead (Y>X)?