Heya,

On Monday, 19 April 2004 at 15:05, Brian Morgan wrote:
> 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:
[snip]

6-fold compression of the main logic:

---
$max = $ARGV[0];
$key = $ARGV[1];
$pad_string = $ARGV[2];

$key .= $pad_string x ($max - length($key));

print $key;
---

Arjen

-- 
Arjen Laarhoven                         |
Email: [EMAIL PROTECTED]             |        
Web: http://www.laarhoven.info          | All that is gold does not glitter...

Reply via email to