#!/usr/local/bin/perl use POSIX; # put it in the "@in" array; do the math operation as we read while (<>) { push @in, int($_ / 16); } # while we have at least 2 items, print a pair while (@in > 1) { print shift(@in), " ", shift(@in), "\n"; } # if we read an odd number, print the final number if (@in) { print $in[0], "\n"; }