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" }
|
---|
Replies are listed 'Best First'. | |
---|---|
little golf
by ccn (Vicar) on Jul 24, 2004 at 10:34 UTC | |
by wfsp (Abbot) on Jul 24, 2004 at 11:18 UTC |
In Section
Seekers of Perl Wisdom