use strict; my $width = 60; while ( ) { 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 #### perl monks1.pl 111111111111111111111111111111111111111111111111111111111111 222222222222222222222222222222222222222222222222222222222222 333333333333333333333333333333333333333333333333333333333333 111111111111111111111111111111111111111111111111111111111111 222222222222222222222222222222222222222222222222222222222222 333333333333333333333333333333333333333333333333333333333333