On 03/14/04 17:50, Chris Knipe wrote:
use warnings;

$ARGV[4] = "100.200.30.40"; # for the sake of clarification.

my @IPs = split('.', $ARGV[4]);

First, the first argument to split is *always* a regex. A lot of people are in the habit of passing a quoted string, but according to the perl5-porters (in a thread about a year or so ago) the first argument should always be a regex. So, use the // or m// syntax.


Doing that should make it obvious what the problem is:

my @IPs = split(/./, $ARGV[4]);
                 ^
dot is a meta character in a regex, so it needs to be quoted:

my @IPs = split(/\./, $ARGV[4]);


if ($IPs[1] < 100) {
  print "TRUE";
} else {
  print "FALSE";
}

running it...
Use of uninitialized value in numeric lt (<) at ./ppp.rotate line 6.

And the condition is *always* true.

Now, as far as I know, this is happening because $IPs[1] isn't a integer,
but a string....  What I don't know, is how to fix this.... :/


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to