in reply to Hex Numbers and Range Operator

I expect you've slapped your forehead by now, but in case you're still scratching it, check this out:
#!/usr/bin/perl -w use strict; my @dec_nums = ( 0 .. 255 ); my @hex_nums = ( 0x00 .. 0xFF ); my @oct_nums = ( 000 .. 0377 ); my $msg = "OMG! Inequality among %d. vs. 0x%02X vs. \\%03o on test #%d +\n"; my $i; for $i ( 0 .. $#dec_nums ) { if ( $i != $dec_nums[$i] or $i != $hex_nums[$i] or $i != $oct_nums +[$i] ) { die sprintf( $msg, $dec_nums[$i], $hex_nums[$i], $oct_nums[$i] +, $i ); } } if ( @dec_nums != @hex_nums or @dec_nums != @oct_nums ) { die sprintf( $msg, scalar(@dec_nums), scalar(@hex_nums), scalar(@oct_nums), $i); } printf( "Whew! 0-%d. is the same as 0x00-0x%X and 000-0%o.\n", pop @dec_nums, pop @hex_nums, pop @oct_nums );