http://www.perlmonks.org?node_id=11113593


in reply to Assigning multiple lines into first element of array

Simple "line at a time" version.

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11113581 use warnings; my $filename = 'file.fasta'; open my $handle, '<', $filename or die "$! opening $filename"; my @array; while( <$handle> ) { /^>/ and push @array, ''; $array[-1] .= $_; } use Data::Dumper; print Dumper \@array;