John W. Krahn wrote:
Or if you really want to do it yourself:
$ perl -le'
my $num = 123456789;
{ my @digits = ( "a" .. "z", "A" .. "Z", 0 .. 9, "-", "_" );
sub fn {
my $in = shift;
my $res = "";
while ( $in ) {
substr $res, 0, 0, $digits[ $in % @digits ];
$in = int( $in / @digits );
}
return $res;
}
}
my $out = fn( $num );
print $out;
'
hw80v
Oops, small correction, that should be:
{ my @digits = ( "a" .. "z", "A" .. "Z", 0 .. 9, "-", "_" );
sub fn {
my $in = shift;
my $res = "";
do {
substr $res, 0, 0, $digits[ $in % @digits ];
$in = int( $in / @digits );
} while $in;
return $res;
}
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>