in reply to script optmization
And if you want to get fancy, maybe even this:my @pat; foreach my $r (@seq) { my $t = $r; $t =~ s/\h+/bbb/g; push @pat, [ $r, $t ]; } while (<$fh>) { foreach my $p (@pat) { s/$p->[0]/$p->[1]/g; } print Newfile; }
my $seq = join '|', @seq; my %seq; foreach my $r (@seq) { (my $t = $r) =~ s/\h+/bbb/g; $seq{$r} = $t; } while (<$fh>) { s/($seq)/$seq{$1}/go; print Newfile; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: script optmization
by shoura (Novice) on May 14, 2017 at 14:41 UTC | |
by Anonymous Monk on May 14, 2017 at 17:13 UTC |