in reply to Re^2: General Purpose String Padding
in thread General Purpose String Padding

The idea would be to discard $max_length entirely. Whatever is providing the value stored in $max_length would now provide a form/template. Of course, this is not necessarily possible in your case.