Perl output overwrites itself while ($line = ) { chomp $line; $line =~ s/ //g; printf "@attribute %s nominaln", $line; } $line =~ s/s//g;