push (my @hexnum, $hexnum); @hexnum = split ( ' ', $hexnum ); #### $_ = ; @hexnum = split; #### sub go { my @esns = @_; ... } #### use English; if (@ARGV and $ARGV[0] eq "-v") { shift; # crude method for option handling (cf. Getopt::Std) print STDERR "ESN Converter v.02\n"; # report version when asked } # (otherwise, keep quiet about that) unless (@ARGV and -r $ARGV[0]) { # if no file name, go interactive print STDERR "Usage: $0 [esn_list.filename]\n"; $eof = ( $OSNAME =~ /.n.x$/ ) ? "^D" : "^Z"; $prompt = "Please enter an ESN string (or $eof to exit): "; print STDERR $prompt; } while (<>) { s/\s+//g; # start by eliminating all whitespace unless ( /^([0-9a-f]{2})([0-9a-f]{6})$/ ) { print STDERR "skipped input string $_ : not a valid ESN\n"; next; # only accept 8-digit hex strings } ($mfg,$serno) = (hex $1, hex $2); printf( "Hex: %s == Decimal: %d %d\n",$_,$mfg,$serno); } continue { print STDERR $prompt if $prompt; }