in reply to IP addresses?

Interesting. So, what exactly is perl doing?
  DB<11> p 74.117.115.116;
Just
  DB<12> p 74;
74
  DB<13> p 74.117;
74.117
  DB<14> p 74.117.115;
Jus
  DB<15> p 74.117.32.32.44.115;
Ju  ,s
The dot operator is used to concatenate strings together, so as long as it doesn't look like a normal integer or floating point number, it assumes they are "strings", and perl is storing them as single byte integers (characters), rather than, for example, the string "74". When printed, out come their ascii representations.

Is this a good description of what's going on internally, or is there some further magic to be explained?

-Scott

Replies are listed 'Best First'.
Re^2: IP addresses?
by phroggy (Monk) on Aug 18, 2005 at 17:33 UTC
    Good observations, but your guesses are completely wrong. See "Version Strings" in perldoc perldata. Looks like support for these is going away after 5.8...

    perl -e '($,,@_)=("er",",\n","l Hack"," P","Just anoth"); print reverse @_;'
      Ah, version strings. I'd forgotten about those.

      It's a nice side effect that "raw" IP addresses end up getting stored like that.

      But, is it portable between big and little endian machines?

      -Scott