[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PERL] Smart måde at checke på?



On Fri, 25 Jan 2002, Carsten Svaneborg wrote:

> Henrik Størner wrote:
>  In <sslug@sslug> Carsten Svaneborg
> <sslug@sslug> writes:
> > Se 'man comm' for andre muligheder. 'uniq -u' kan måske også bruges.
>
> Man kunne sikkert sagtens skrue en løsning samme, desværre
> fortalte jeg ikke det hele i sidste indlæg. ;*)
>
> Jeg ville dog meget gerne læse input på linie basis, og
> udskrive alle de linier

#!/usr/bin/perl

@known=`cat knownpatents`;

chomp(@known);
@eval_sub = map { '/'.$_.'/ and next;' } @known;

$eval= 'while(<>) {' . join("",@eval_sub) . 'print;}';
eval $eval;

> > Det kan sikkert gøres uden de store sværdslag i perl/python/whatever.
> Med O(n) søgning ja. Men det er ikke sjovt at lave!

#!/usr/bin/perl

@known=map { lc($_) } `cat patents`;
chomp(@known);
@sslug@sslug .. @known;

while(<>) {
    @words = split /[^-a-z0-9]+/i, lc($_);
    if(not join("",@sslug@sslug)) {
        print;
    }
}


/Ole
-- 
Søges: 2-3 vær. lejlighed i Kbh K N Ø V. Eje, andel eller leje. Pris < 55/m2
Så hvis du kender nogen, der kender nogen, så drop en mail.




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 19:54 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *