in reply to add new lines to output.

I'm thinking that line 5 is print $1   "\n";. You skipped a comma there, so Perl interprets that as printing to a filehandle in $1. You likely mean:

open (FILE,"abc345.txt") or die $!; while (<FILE>){ $_ = /((^Query = .*)|(^\>.*)|(Length = .*))/i; print "$1\n"; print "$2\n"; print "$3\n"; print "$4\n"; } close (FILE) ;

or

open (FILE,"abc345.txt") or die $!; while (<FILE>){ $_ = /((^Query = .*)|(^\>.*)|(Length = .*))/i; print $1, "\n"; print $2, "\n"; print $3, "\n"; print $4, "\n"; } close (FILE) ;

See print for info on proper syntax.