#!/afs/athena/contrib/perl5/p -w

use strict;
use FileHandle;

my $Evil = new FileHandle 'whois "Cyber Promotions" |';
$Evil || die 'I see no evil (no whois in path?)';

print STDERR "Reading data...\n";
my @Lines = <$Evil>;
print STDERR "Processing...\n";

my $i = 0;
while ($i < @Lines) {
  if (($i > 0) && ($Lines[$i] =~ /^\s/)) {
    splice @Lines, $i-1, 2, ($Lines[$i-1].$Lines[$i]);
  } else {
    $i++;
  }
}

@Lines = grep /-DOM\)/, @Lines;
foreach (@Lines) {  s/\s+$//;   s/.*\s//g;  }

print dblquote('"'.join("\\|", map "\L\Q$_\E", @Lines)."\"\n");

sub dblquote {
  local($_) = @_;
  s/\\/\\\\/g;
  $_;
}
