Нужен простенький скрипт на Perl

Discussion in 'PHP' started by SladerNon, 16 Jun 2005.

  1. SladerNon

    SladerNon Адам

    Joined:
    6 Mar 2005
    Messages:
    1,636
    Likes Received:
    941
    Reputations:
    355
  2. SladerNon

    SladerNon Адам

    Joined:
    6 Mar 2005
    Messages:
    1,636
    Likes Received:
    941
    Reputations:
    355
    Кто у нас дружит с Перлом? =). Прошу откликнуться =)
     
  3. nerezus

    nerezus Banned

    Joined:
    12 Aug 2004
    Messages:
    3,191
    Likes Received:
    729
    Reputations:
    266
    Code:
     #!/usr/bin/perl
    use strict;
    my %h;
    open F, "input.txt";
    while (my $line=<F> ) {
        $line =~s/\s//;
        chomp $line;
        $h{$line}++;
    }
    close F;
    while ((my $key, my $value)=each(%h)) {
        print $key."\n" if ($value==1);
        print $key."\n".$key."\n" if ($value==2);
    }
     
  4. Майор

    Майор Active Member

    Joined:
    24 Oct 2004
    Messages:
    558
    Likes Received:
    112
    Reputations:
    146
    php :

    <?
    $url=file('url.txt');
    for($i=0;$i<count($url);$i++){
    for($j=0;$j<count($url);$j++)
    if(!strcasecmp($url[$i],$url[$j]))
    $k++;
    if($k<=2)
    echo "$url[$i]";}
    ?>
     
  5. SladerNon

    SladerNon Адам

    Joined:
    6 Mar 2005
    Messages:
    1,636
    Likes Received:
    941
    Reputations:
    355
    Башое спасибо! =)
     
  6. nerezus

    nerezus Banned

    Joined:
    12 Aug 2004
    Messages:
    3,191
    Likes Received:
    729
    Reputations:
    266
    2Майор: твой не работает =)
    1 строку выдает
     
  7. KEZ

    KEZ Ненасытный школьник

    Joined:
    18 May 2005
    Messages:
    1,604
    Likes Received:
    754
    Reputations:
    397
    SladerNON, ты же крутой хакер ;)