/[bfilter]/trunk/bfilter.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bfilter.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 35 by dpavlin, Sat Oct 9 21:00:06 2004 UTC revision 36 by dpavlin, Sun Oct 10 08:30:36 2004 UTC
# Line 2  Line 2 
2  #  #
3    
4  use strict;  use strict;
 use locale;  
5    
6  # maximum entries  # maximum entries
7  my $max = 0;  my $max = 0;
# Line 62  while(<STDIN>) { Line 61  while(<STDIN>) {
61          push @lines, $_;          push @lines, $_;
62  }  }
63    
64  # spaces will be ignored when sorting using locale. That's why we have  foreach (sort { lc($a) cmp lc($b) } @lines) {
 # cache of lines with spaces replaced by exclamation mark (!) so that  
 # sort order is strict and not dictionary. For more info, see:  
 # http://archives.postgresql.org/pgsql-sql/2002-04/msg00266.php  
 # http://groups.google.com/groups?selm=handler.82819.D82819.99045085113033.ackdone%40bugs.debian.org&output=gplain  
   
 my %locale_space_fix;  
   
 foreach (sort {  
                 unless($locale_space_fix{$a}) {  
                         my $tmp = $a;  
                         $tmp =~ s/ /!/g;  
                         $locale_space_fix{$a} = lc($tmp);  
                 }  
                 unless($locale_space_fix{$b}) {  
                         my $tmp = $b;  
                         $tmp =~ s/ /!/g;  
                         $locale_space_fix{$b} = lc($tmp);  
                 }  
                 $locale_space_fix{$a} cmp $locale_space_fix{$b};  
         } @lines) {  
65    
66          my @data = split(/\t+/,$_);          my @data = split(/\t+/,$_);
67    

Legend:
Removed from v.35  
changed lines
  Added in v.36

  ViewVC Help
Powered by ViewVC 1.1.26