in reply to Removing duplicates from list
Example just teaking your code slightly:
use strict; use warnings; open (MER, "Extracted.c") or die "Can't open input file. $!\n"; my %cases; for my $mer(<Mer>){ my $control; while ($control!=15){ $mer =~ s/ //; $control++; } $cases{$mer}++; } foreach $key ( keys %cases ) { print $key, "\n"; }
I'm not really clear on that the inner loop is for. You only want to remove the first fifteen spaces from $mer? ...ok. I guess that's working out ok. You could alternatively use something like:
substr($mer,0,15) =~ s/ //g;
That would eliminate the while loop and $control counter.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Removing duplicates from list
by Levan (Novice) on Oct 14, 2003 at 07:20 UTC |