-1

I am trying to ping a IP on HPUX. I am using the commands

ping 15.178.209.120 64 10

and

ping -c 10 15.178.209.110

perl code that i am using is

$Ping  = `  ping -c 10 15.178.209.110`;

$ping is empty.

I tried in HPUX also. It's not pinging. It's saying command not there. What is the equivalent command for ping in HPUX

j0k
  • 22,600
  • 28
  • 79
  • 90
Nitesh
  • 157
  • 10
  • 3
    Google for `ping hpux` gives many answers. Perhaps you need to install it, or give a full path (maybe `/usr/sbin/ping` or something else). – Basile Starynkevitch Dec 22 '11 at 10:38
  • the command ping itself is unrecognised – Nitesh Dec 22 '11 at 10:48
  • @Nitesh — Basile has given you two approaches that might resolve that. – Quentin Dec 22 '11 at 10:54
  • 2
    This is exactly why Perl contains the Net::Ping module. So that you can write portable code that doesn't rely on external programs that might move (or might not exist) on different platforms. – Dave Cross Dec 22 '11 at 10:57
  • @Basile: Thanks. It was the directory issue only. I gave the path alongwith ping. now its workinh. Thanks a lot – Nitesh Dec 22 '11 at 10:58

2 Answers2

7

Net::Ping is a core module in perl. If it is a perl solution you are looking for.

TLP
  • 66,756
  • 10
  • 92
  • 149
  • i tried manually also in hpux. the command ping itself is not recognised – Nitesh Dec 22 '11 at 10:50
  • 1
    @Nitesh — So what? As far as I can tell, by skimming the source, Net::Ping uses socket modules and doesn't shell out to call a `ping` binary. – Quentin Dec 22 '11 at 10:52
  • 3
    @Nitesh The command ping in the shell is not the same thing as the Net::Ping module in perl. Perl can solve this task for you. – TLP Dec 22 '11 at 10:54
1

I noticed you have $Ping (capital P) for the external execution and then $ping (lowercase p) which you say is empty. Could this be your problem?

MSwanberg
  • 11
  • 1