for my $line (@l){ chomp $line; # Remove the newline from the end print $line . " - processed by 'trenchwar'\n"; # Add a little content to each line } #### for (@l){ chomp; print "$_ - processed by 'trenchwar'\n"; } #### chomp @l; # Remove the newline from all elements print map { "$_ - processed by 'trenchwar'\n" } @l; #### open (FH3, ">lessons.txt"); ### You should *always* check the return from any calls to the system. open FH3, ">lessons.txt" or die "lessons.txt: $!\n"; ### You should also close this filehandle; don't assume that your file has actually ### been written before you do so! close FH3; $l="lessons.txt"; open(FH3, $l) || die("Could not open file!"); ### Don't create variables that you're only going to use once; just use the value. ### *And* check the return of the call. And don't pre-assume the reason for failure: ### find out what it is with the '$!' (actual error) variable. open FH3, "lessons.txt" or die "lessons.txt: $!\n";