$ skip($handle, n, [buffer size])

reads and discards up to n bytes from the specified handle. this is useful for causing data to be read and processed without the expensive conversion process to sleep strings (i.e. when one wants to &digest or &checksum a file)


$handle - the handle to consume bytes from

n - the number of bytes to consume

buffer size - the size of the byte buffer for consuming bytes, this value can affect performance. default is 32KB.


The number of bytes consumed. If no bytes were consumed or an error occured then $null is returned.

Side Effects / Notes


# generate an MD5 digest of any file. sub md5 { $handle = openf($1); $digest = digest($handle, "MD5"); # consume the handle skip($handle, lof($1)); closef($handle); $result = unpack("H*", digest($digest))[0]; println("MD5 ( $+ $1 $+ ) = $result"); } md5(@ARGV[0]);

MD5 ( = ff4ddf4a2006140f8db28904de9e288b

See Also