How about this?
use strict;
my $width = 60;
while ( <DATA> ) {
chomp;
my ($len,$more);
my $char;
next if ( /^[^\w\d]/ );
$char = substr($_,0,1);
if ( ($len = length()) < $width ) {
$more = $width - $len;
print $_ . $char x $more,"\n";
} else {
print "$_\n";
}
}
##
__DATA__
111111111111111111111
222222222222222222222
333333333333333333333
111111111111111111111
222222222222222222222
333333333333333333333
output was:
perl monks1.pl
111111111111111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222
333333333333333333333333333333333333333333333333333333333333
111111111111111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222
333333333333333333333333333333333333333333333333333333333333
_
_
_
_
_
_
_
_
_
_
- Jim
Insert clever comment here...