open(A,">Result.txt"); while() { my($one,$two,$three)= split(/\s+/,$_); my $delim=' '; my $one1=length($one); my $two1=length($two); my $three1=length($three); my($one2,$two2,$three2); if($one1 < 10) { my $one11= (10-$one1); my $fdelim=$delim x $one11; $one2=$one.$fdelim; } if($two1 < 7) { my $two11= (7-$two1); my $fdelim=$delim x $two11; $two2=$two.$fdelim; } if($three1 < 8) { my $three11= (8-$three1); my $fdelim=$delim x $three11; $three2=$three.$fdelim; } print A "${one2}${two2}${three2}\n"; } close(A) __DATA__ The Early Year Five New Swine