#!/usr/athena/bin/perl use strict; sub gray; # get arguments my $n = shift; my $nstop = shift; # defaults $nstop = $n, $n = 0 if ($nstop == undef); $nstop = 256 if ($nstop == undef); # bounds check $n = 0 if ($n < 0); $nstop = 0 if ($nstop < 0); print $n . "\t" . gray ($n++) . "\n" while ($n <= $nstop); exit; sub gray { my $n = shift; return ((2 * $n) ^ ($n)); }