John W. Krahn wrote:
$!/usr/bin/perl
Sorry for the typo. That should be: #!/usr/bin/perl
use warnings; use strict; my $decimal_code = shift or die "usage: $0 <decimal code>\n"; my $binary_code = unpack 'B32', pack 'N', $decimal_code; my @itu_code = $binary_code =~ / (\d{3}) (\d{8}) (\d{3}) $ /x; my @ansi_code = $binary_code =~ / (\d{8}) (\d{8}) (\d{8}) $ /x; print "itucode = @itu_code\n”; print "ansicode = @ansi_code\n”; printf "Decimal Code = [%05d]\n", $decimal_code; printf "ITU Cisco Code = %03d-%03d-%03d\n", map oct( '0b' . $_ ), @itu_code; printf "ANSI Cisco Codec = %03d-%03d-%03d\n", map oct( '0b' . $_ ), @ansi_code; __END__
John -- Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction. -- Albert Einstein -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/