Arjen Laarhoven <[EMAIL PROTECTED]> wrote:
> $max = $ARGV[0];
> $key = $ARGV[1];
> $pad_string = $ARGV[2];
>
> $key .= $pad_string x ($max - length($key));
> print $key;
That's pretty much the canonical example. Only thing I'd do
is twink around with the rigging, e.g.
my( $max, $key, $pad ) = @ARGV;
print $key, $pad x ($max - length($key));
My own thoughts tend toward the following:
$_ = $pad x $max;
substr( $_, 0, length($key) ) = $key;
print;
But I can't shake the feeling that that second line
could be shortened, perhaps by using s/// cleverly...
--
John Douglas Porter
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25�
http://photos.yahoo.com/ph/print_splash