use strict; use warnings; open (my $output, '>', 'output.txt') or die "cannot open > output.txt $!"; select $output; open (my $file, '<', 'file.txt') or die "cannot open < file.txt $!"; while (<$file>) { print unless (/^A/) } select *STDOUT; print "All Done.\n";