$/="\n"; open(FH,">>/tmp/statusdump.txt"); while(my $data=<$sock>){ $data =~ /[a-z]/ || next; print FH $data; } close FH;