in reply to Re: Padding strings for a flat file
in thread Padding strings for a flat file

I wonder if this might be a good time to use Perl's bizarre pass-by-reference semantics?
sub pad { my $char = pop; my $max = pop; $char = " " unless defined $char; $_[0] .= $char x ($max - length $_[0]); }
Now:
pad($v, 30, 'x'); # $v is now 30 characters long print $v;