"Fossies" - the Fresh Open Source Software Archive

Member "whois/make_as_del.pl" (27 Jul 2017, 433 Bytes) of package /linux/privat/whois_5.5.9.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "make_as_del.pl" see the Fossies "Dox" file reference documentation.

    1 #!/usr/bin/perl
    2 
    3 use warnings;
    4 use strict;
    5 
    6 my $last_l = 0;
    7 
    8 while (<>) {
    9     chomp;
   10     s/#.*$//;
   11     s/^\s+//; s/\s+$//;
   12     next if /^$/;
   13 
   14     die "format error: $_" if not (/^([\d\.]+)\s+([\d\.]+)\s+([\w\.]+)$/);
   15     my $f = $1; my $l = $2; my $s = $3;
   16 
   17     die "constraint violated: $l < $last_l" if $l < $last_l;
   18     $last_l = $l;
   19 
   20     print "{ ${f}, ${l}, \"";
   21     if ($s =~ /\./) {
   22         print "$s";
   23     } else {
   24         print "whois.$s.net";
   25     }
   26     print qq(" },\n);
   27 }
   28