in reply to Re^2: problem with $ARG
in thread problem with $ARG
-M5.010 -e
can be written as
-E
(gethostbyname($ARGV[0]))[4])
is clearer as
scalar(gethostbyname($ARGV[0]))
or just
gethostbyname($ARGV[0])
if you check if gethostbyname succeeded.
perl -MSocket -E'say inet_ntoa gethostbyname(shift)||die "Not found\n"' example.com
|
|---|