in reply to how to merge the files of DNA sequences?
This is what I came up with:
Updated: Use hash instead of a hashref#!/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" }
In Section
Seekers of Perl Wisdom