perlquestion
drock
I have this code wherein I would like to determine if the number is a valid ip address. But I keep getting this error:
23.23.109.103
Undefined subroutine &main::ipv4check_ip called at number_test.pl line 15 (#1)
(F) The subroutine indicated hasn't been defined, or if it was, it has
since been undefined.
Uncaught exception from user code:
Undefined subroutine &main::ipv4check_ip called at number_test.pl line 15.
Can anyone help please! thank you!
<code>
#!/usr/local/bin/perl
use strict;
use warnings;
use diagnostics;
use Net::IPv4Addr qw( :all );
my $var = "23.23.109.103";
print "$var\n";
#if ($var =~ m/^\d+$/) {
#if ($var !~ /\D/) {
if ( $var = ipv4check_ip($var)) {
print "your variable is a number $var\n";
} else {
print "number $var is not a number\n";
}
</code>