Script Ping (Host To IP) to the variable.

Hi, I do not know how to write a script. Please help.
I would like to use ping to the domain.
Then assign the host IP to a variable.

:local PingResult

:set PingResult [ping www.google.com count=2]
:put $PingResult
:log info $PingResult

result
:log info “2”

How to do that resulted in the IP:
:log info “213.241.87.25”

To log the IP, do this:

:log info [:resolve www.google.com]

IMHO better way is to “fix” IP durig test to prevent situation when http://www.google.com could resolve to different IPs

:local PingResult
:local PingIP

:set PingIP [:resolve www.google.com]
:set PingResult [ping $PingIP count=2]
:put $PingResult
:log info $PingIP