Just want some advice on pulling the information I want from output that I am getting in a script. I am basically doing:  `host google.com 8.8.8.8` or something to that effect. That output when just using the command line will be something like this:
Using domain server: Name: 8.8.8.8 Address: 8.8.8.8#53 Aliases: google.com has address 74.125.113.147
What would be the best way to extract the 74.125.113.147 in a general way so it could be done with whatever website is checked? I did a previous matching for an ip that looked like this:
if ($found_addr =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { . . .
But THAT wouldn't work because the output shows the domain server we're using, in this case google's 8.8.8.8 Can I pull something by line number? update 1/27 Ended up using
if ($found_addr =~ m/(\d.*)/) {
On the linux boxes since they pull up the host info a little differently. overall, this was pretty successful though. thanks for the advice.

In reply to More complicated regular expression? by jaldama

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.