A search on the fora returned me amongst other this sub:
Can somebody explain what the first statement is used for? I see no further use of $self in this sub?
_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
Code:
sub is_ipv4 {
my $self = shift if ref($_[0]);
my $value = shift;
return unless defined($value);
my(@octets) = $value =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
return unless (@octets == 4);
foreach (@octets) {
return unless ($_ >= 0 && $_ <= 255);
}
return join('.', @octets);
}
Can somebody explain what the first statement is used for? I see no further use of $self in this sub?
_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]