Hello all,
Here is something that I have been playing with, and I am wondering if it can be shortened at all.


The script is given a string that is shorter then a MAX length as well as a special character. It
then adds onto the end of the string the special character until the length of the string is equal
to MAX.


Here is my solution as an example of what I am talking about:
#BEGIN EXAMPLE

$max = $ARGV[0];
$key = $ARGV[1];
$pad_string = $ARGV[2];
@key_chars = split(//, $key);
$count = $#key_chars + 1;
while ($count <= $max){
   $key .= $pad_string;
   $count++;
}
print $key;

#END EXAMPLE

So can anyone out there compress this down? I can't wait to see the results.

Thanks,
Brian




Reply via email to