http://qs1969.pair.com?node_id=377110


in reply to how to merge the files of DNA sequences?

This is what I came up with:
#!/bin/perl5 use strict; use warnings; @ARGV = qw( file1.txt file2.txt ); my $name; my %hash; while (<>){ chomp; my $record = $_; if ( $record =~ /^>/ ){ $name = $record; next; } else{ $hash{$name} .= $record } } for my $key ( keys %hash ){ print "$key\n$hash{$key}\n" }
Updated: Use hash instead of a hashref