jonsmith1982 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; # ip address limit # 83.1.1.1 my $a_end = 83; my $b_end = 1; my $c_end = 1; my $d_end = 1; # ip address start # 82.1.1.1 my $a_start = 82; my $b_start = 1; my $c_start = 1; my $d_start = 1; my @calc = ($a_start, $b_start, $c_start, $d_start, $a_end, $b_end, $c +_end, $d_end); my $calc; my $calc1; my $calc2; foreach $calc (@calc) { if ($calc<100) { if ($calc<10) { $calc="00".$calc; } else { $calc="0".$calc; } } } $calc1 = $a_start . $b_start . $c_start . $d_start; $calc2 = $a_end . $b_end . $c_end . $d_end; print $calc1." + ".$calc2." = \n"; if ($calc1>=$calc2) { print "error!\n"; exit(0); } exit(0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: comparing two ip addresses.
by ikegami (Patriarch) on Sep 15, 2006 at 21:55 UTC | |
by jonsmith1982 (Beadle) on Sep 16, 2006 at 12:14 UTC | |
|
Re: comparing two ip addresses.
by shmem (Chancellor) on Sep 16, 2006 at 00:22 UTC | |
|
Re: comparing two ip addresses.
by CountZero (Bishop) on Sep 16, 2006 at 08:57 UTC | |
by shmem (Chancellor) on Sep 16, 2006 at 09:52 UTC | |
by aquarium (Curate) on Sep 16, 2006 at 14:51 UTC | |
by ikegami (Patriarch) on Sep 16, 2006 at 09:34 UTC | |
by jdporter (Paladin) on Sep 16, 2006 at 15:19 UTC |