my $length = length($contents) / 8; foreach (my $i = 0; $i < $length; $i ++) { my $offset = $i * 8; print ord substr($contents, $offset, 8), "\n"; }