in reply to Help with script

Show us what you've tried before (use code tags), and tell us how it fails to meet your expectations (e.g., "I thought this function would ping $host and capture the results, but the results it returns are empty" -- or whatever the problem is that you're having).