in reply to How do I sort a file with IP Addresses and another text column

Well, rather than doing it for you, I'll try to point you to some information that you can use to do it one way (remember, TMTOWTDI):<bl>
  • You can split up your line on commas and/or periods using split
  • You can use Array Slices to make sub-arrays out of arrays
  • You can use pack to stick the dotted numbers together as 4-character binary strings, after splitting them.
  • You can use the Schwartzian Transform to process the data, sort it, and then transform it back to a printable format
  • You can use sprintf with the "%vd" format specifier to print a 4-character binary string as a dotted IP address (if you have Perl 5.6.0 or later)
  • </bl>

    I'm sure someone else will come up with something simpler; this is what occurred to me.

    • Comment on Re: How do I sort a file with IP Addresses and another text column