in reply to Re: v notation and IP addresses
in thread v notation and IP addresses

Version strings are not meant to be used for IP addresses.

In fact, I think they were... Not that you should ever actually use them.

use strict; use warnings; use Socket; my $perlmonks1 = inet_aton("66.39.54.27"); my $perlmonks2 = v66.39.54.27; print "Holy crap, this really works?\n" if $perlmonks1 eq $perlmonks2;

And atually, yes, it does work for values higher than 127...

for my $IP (qw(66.39.54.27 209.197.123.153 208.159.114.4)) { my $perlmonks1 = inet_aton($IP); my $perlmonks2 = eval qq{ v$IP } or die $@; print "Holy crap, this really works ($IP)?\n" if $perlmonks1 eq $p +erlmonks2; }

-Paul

Replies are listed 'Best First'.
Re^3: v notation and IP addresses
by jwkrahn (Abbot) on Jul 11, 2009 at 22:19 UTC

    How do you morph "Version Strings" into "meant to be used for IP addresses"?

      I don't. As far as I know, historically speaking, they were just called version strings. They were always intended for encoding octets usefully. I'm not saying it was a good idea, I'm just saying they intended it.

      -Paul