perl -e '$n=3; print substr( unpack("B*", pack("N",$_)), -$n), "\n" for (0..2**$n-1)'