Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanks in Adv,file:foreach (@array){ $match=0; my @tmparr; my @line=split(/\t/); foreach $key_pos(sort keys(%conwithposition)) { if ($conwithposition{$key_pos}[0] eq '=') { if ($conwithposition{$key_pos}[1] eq $line[$key_pos] +) { $match=1; }else{ $match=0; next file; } }elsif($conwithposition{$key_pos}[0] eq '!='){ if ($conwithposition{$key_pos}[1] ne $line[$key_pos] +) { $match=1; }else{ $match=0; next file; } }elsif ($conwithposition{$key_pos}[0] eq '>'){ if ($conwithposition{$key_pos}[1] gt $line[$key_pos] +) { $match=1; }else{ $match=0; next file; } }elsif ($conwithposition{$key_pos}[0] eq '>='){ if ($conwithposition{$key_pos}[1] ge $line[$key_pos] +) { $match=1; }else{ $match=0; next file; } }elsif ($conwithposition{$key_pos}[0] eq '<'){ if ($conwithposition{$key_pos}[1] lt $line[$key_pos] +) { $match=1; }else{ $match=0; next file; } }elsif ($conwithposition{$key_pos}[0] eq '<='){ if ($conwithposition{$key_pos}[1] le $line[$key_pos] +) { $match=1; }else{ $match=0; next file; } } } if ($match){ #All the conditions met. Push this line of file to +@result_arr foreach $col(sort {$a<=>$b} keys(%cols_pos)){ push @tmparr,$line[$col]; } $tmparr=join("|",@tmparr); push @listcols,$cols_pos{$col}; push @result_arr,[ $tmparr ]; } }#file:for
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Increasing the efficiency of the code
by Limbic~Region (Chancellor) on Nov 29, 2006 at 13:08 UTC | |
|
Re: Increasing the efficiency of the code
by GrandFather (Saint) on Nov 29, 2006 at 12:39 UTC | |
|
Re: Increasing the efficiency of the code
by madbombX (Hermit) on Nov 29, 2006 at 12:32 UTC | |
|
Re: Increasing the efficiency of the code
by Fengor (Pilgrim) on Nov 29, 2006 at 13:04 UTC | |
by Limbic~Region (Chancellor) on Nov 29, 2006 at 13:14 UTC | |
by Fengor (Pilgrim) on Nov 29, 2006 at 13:20 UTC |