#!/usr/bin/perl -w use strict; find_serv (); sub find_serv { @ARGV == 2 || die "usage: $0 INDEX_FILE '.com'\n";# .com---->icq.com my ( $INDEX_FILE, $com ) = @ARGV; my $list = "grep 'href=' $INDEX_FILE|" ;#- $INDEX_FILE --> wget www.icq.com open (my $HAN, "$list" ) || die "Cannot open '$INDEX_FILE' because:: $!"; while (<$HAN>) { chomp $_; my @array = split (/\//, $_); if ($array[2] =~ /$com/ ){#matches icq.com my @sort = $array[2]; #my $result = `sort -u '$sorted'`; #print "$result\n"; system "sort -u '$array[2]' > '$array[2].sorted'"; rename "$array[2].sorted", $array[2]; print "$array[2]n"; }} } #END