Perl : code on ping showing difference result | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Perl : code on ping showing difference result

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-05-2013
scriptscript scriptscript is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 30 January 2014, 11:03 AM EST
Posts: 74
Thanks: 21
Thanked 0 Times in 0 Posts
Perl : code on ping showing difference result

Hi all,

I am using the below code to ping a code and print whehter the connection is successful or not.

Code:
    use Net::Ping;
    $p = Net::Ping->new();    
    my $host = "x.x.x.x";
   # print "$host is alive.\n" if $p->ping($host);
    if ($p->ping($host,3))
    {
        print "success";
    }
    else
    {
         print "Fail";
    }     
    $p->close();

For one IP address.. I received the status as "Fail" . But when tried using start->run-> cmd ->ping ipaddress .. the ping is successful.

COuld you let me know any other alternative code to ping the device.

---------- Post updated at 06:57 AM ---------- Previous update was at 06:50 AM ----------

Hi all,

I am using the below code to ping a code and print whehter the connection is successful or not.

Code:
    use Net::Ping;
    $p = Net::Ping->new();    
    my $host = "x.x.x.x";
   # print "$host is alive.\n" if $p->ping($host);
    if ($p->ping($host,3))
    {
        print "success";
    }
    else
    {
         print "Fail";
    }     
    $p->close();

For one IP address.. I received the status as "Fail" . But when tried using start->run-> cmd ->ping ipaddress .. the ping is successful.

COuld you let me know any other alternative code to ping the device.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ps command showing full code of running script rajeevra Shell Programming and Scripting 2 05-28-2012 08:41 AM
solaris link aggregation problem , once i reboot it is not showing, not able to ping the default gat buildscm Solaris 2 01-18-2012 09:14 AM
Ping and Perl ab52 Shell Programming and Scripting 1 08-14-2011 07:46 AM
Help with showing the difference in two lines of input Kweekwom Shell Programming and Scripting 12 02-14-2008 06:16 PM
defined value not showing....in the result happyv Shell Programming and Scripting 1 01-26-2007 03:58 AM



All times are GMT -4. The time now is 08:38 PM.