I am new to Perl and a little stumped on parsing the lines for a traceroute. This is typical of the output that I am challenged with.
3 someURL.net (184.106.126.128) 0.579 ms someURL.net (184.106.126.124) 0.742 ms 0.719 ms
Note how the 1st and 2nd routes use a different IP address. This will change; e.g., sometimes the hops will use all the same like this:
3 someURL.net (184.106.126.128) 0.579 ms 0.742 ms 0.719 ms
...or, each hop could have a different route, or they could all be the same. I would like to use some regex, etc. in Perl to format the output like this:
3|url~ip~time|url~ip~time|url~ip~time
I'm not sure if I should loop through the individual words somehow, or if it is easier to do it all with regex. Any solutions or hints appreciated.