in reply to Re^2: IP address validation when IP is picked dynamically
in thread IP address validation when IP is picked dynamically
use warnings; use strict; use Data::Validate::IP qw(is_ipv4); while (my $line = <DATA>) { chomp $line; my($key, $parameter_value) = split("=", $line); if (is_ipv4($parameter_value)) { print $parameter_value; } else { print "Fail" } } print "\n"; __DATA__ abc=1.2.3.4
It prints "1.2.3.4". If you comment out the chomp line, it prints "Fail".
Maybe $parameter_value isn't what you think it is. Tip #2 from the Basic debugging checklist: print
my($key, $parameter_value) = split("=", $line); print ">>>$parameter_value<<<\n";
|
|---|