[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] sifting



On Wed, Apr 12, 2000 at 01:06:47PM -0400, Ronald J Kimball wrote:
> sub sift {
> 
>     my @list = @{ shift(@_) };
>     my @re = @_;
> 
>     my $list_l = length @list;
>     my $re_l = length @re;

      my $i;
      my @c;

      # if you care about silly things like use strict.  :)

>     foreach (@list) {
>         for ($i = 0; $i <= $#re; ++$i) {
>             last if /$re[$i]/;
>         }
>         $_ = sprintf "%0${re_l}d%0${list_l}d%s", $i, $c[$i]++ || 0, $_;
>     }
>     map { substr($_, $re_l + $list_l) } sort @list;
> 
> }
> 

Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe