in reply to storing result in variable

You can go about it by opening it with the following:

open my $ping, "ping $host |"; my @pings = <$ping>; close $ping;

Which will leave you with an array of the ping results.

You can read more about this in perlopentut or perlipc