any ideas on how i can tell if 1 ip is higher than the other?
heres what ive thought might work, but didn't.
#!/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);
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.