#!/usr/bin/perl -w # # freenntp.pl - extract and sort links to news servers # AYM 2000-12-28 # use strict; my %hosts; undef $/; while (<>) { my @new = m/href="news:(?:\/\/)?([^"\/]+)"/gi; foreach my $host (@new) { if ($host =~ /^[0-9.]$/) { $hosts{$host} = $host; } else { my @components = split /\./, lc $host; my $forsort = join "\0", reverse @components; $hosts{$forsort} = $host; } } } foreach (sort keys %hosts) { print "$hosts{$_}\n" or print STDERR "freenntp.pl: stdout: $!\n" and exit 1; } exit 0;