From: Martijn Lievaart on
On Sun, 01 Aug 2010 15:34:18 -0700, sln wrote:

>>
>>my %positions;
>>while ($line = <DATA>) {
>
> chomp $line;
>
> Because ",,,,,\n" and if ("\n") is true and the output is:
> The positions that matched: 1ASD 1BDD 1AA 1ADSS 1ASC 1CLK3 where
> 1CLK3 does not match:

Good catch.

>
>> my ($function, @people) = split /,/, $line;
>
> Here, every single line is split() even if it is not an interresting
> line. I find it hard to believe there could be millions of function
> id's, though there might be more position codes.

"Make it right first, optimize later". But this is an obvious
optimazation, yes.

>
>> next unless grep { $_ eq $function } @in; # skip uninteresting
> ^
> grep's gonna loop through all @in every time. Would there be better
> performance if it were a hash? next unless exists $in{ $function };

Same, but as @in is relatively small, I doubt it's going to make a
(noticable) difference.

M4