#!/usr/bin/perl -w
use strict;
use DB_File;





my %urls;
my @base;
my $domain;
my $url;
my $file= "/home/tfe/web/dl/urls";


open(INFO,$file);
while(<INFO>)
{
    $urls{(split / /)[0]}  = $_;
}
untie(%urls);
close INFO;

$_ = ":server PRIVMSG \$chan :message http://www.google.com/linux fin";


if (/
	(   (?:https|ftp|http)
            :\/\/
	    [\w\-\.]+\.[a-z]{2,3}
	)					#capture du domaine
	(?::\d+)?
	(
	(\/[\w\-\.]+(?:\s|$))?
	)					#suite de  l url
    /ix)
    

{
($domain,$url) = ($1," $2 ");
    print "Domaine: $domain\nurl: $url\n\n";
if ($urls{$domain}) { print "TROUVE\n"; }
else { 
$urls{$domain} = "$domain $url\n";
open(INFO,">$file");
foreach(keys %urls)
{
    print INFO "$urls{$_}";
}
close INFO;
print "Nouveau\n"; }
    
}
    
    