473,394 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

PING server problem [PERL] - I'm getting a T-BF / ¬='e' error.

135 100+
PERL Code to Ping a server:

Expand|Select|Wrap|Line Numbers
  1. #!c:/Perl/bin/perl.exe
  2.  
  3. use Net::Ping;
  4. use strict;
  5. use warnings;
  6.  
  7. my $host = 192.168.0.1; # Real value removed by MODERATOR
  8. my $p = Net::Ping->new("tcp", 300);
  9. my $result = $p->ping($host) ? "On.\n" : "Off.\n";
  10.  
  11. $p->close();
  12.  
  13.  
  14. print <<EOF;
  15.  
  16. <html>
  17. <body>
  18. <h2> The $host is $result</h2>
  19. </body>
  20. </html>
  21.  
  22. EOF
  23.  
  24. __END__
  25.  
***** Guy's I'm either getting the T-BF or ¬='e' error where the $host is ******
***** OUTPUT: The T-BF is Off or The ¬='e' is Off ******

What I'm I doing wrong?
Jun 11 '07 #1
3 1538
miller
1,089 Expert 1GB
Patal,

Your problem is in your assignment to $host. You need to include that value in quotes to treat it like a string. That type of assignment is allowed only for legacy reasons. It's essentially treated like a version number of perl. To read about it look here:

perldoc perldata - Search for "Version Strings"

Note: I've simplified your code a little above and replaced the IP with a private IP.

- Miller
Jun 11 '07 #2
patelxxx
135 100+
Thank you again Miller.
Jun 12 '07 #3
miller
1,089 Expert 1GB
Your welcome

- Miller
Jun 12 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Alexandre Plennevaux | last post by:
hello ! I would like to measure the time a user needs to connect to my website. In other words, to perform a ping between my website and the user's computer. I'm scratching my head as to how...
0
by: Sleiman | last post by:
Hello newsgroup readers I am looking for a php implementation for xmlrpc ping server. Do you have any idea where I can find one? Using mod_pubsub I can have a very nice blogchatter style of...
4
by: Tim Marshall | last post by:
Originally posted with Comp.lang.php spelt stupidly incorrectly. Please accept my apologies for the resultant multi-post.... Hi, I'm cross posting to comp.infosystems.www.authoring.html and...
3
by: bernd wegener | last post by:
Hello netties, I coded the following in perl: open(LOGFILE,">&STDOUT") ; if ( $ARGV ) { close(LOGFILE) ; open(LOGFILE,">> $ARGV") or die "Cannot open file $ARGV\n" ;
3
by: Jason Rodman | last post by:
I have downloaded every example on how to create a ping utility in .Net in both VB and C#, but have been disappointed with the results. I have YET to find an example that returns consistent results...
14
by: Egil Hansen | last post by:
Hi I'm wondering if its possible to write a javascript, that can ping a ip and return the average round trip time (like ping in dos/linux)? Regards, Egil.
13
by: Adam | last post by:
Hi! I'm trying to write a small application for an online gaming site (flight sims), where people can add their local server to a list. Basically, I just need to be able to loop/ping each...
1
by: erock34 | last post by:
Trying to ping a list of servers using ping, but I get a return on the unpingable servers. I want to get a list of unsuccessful pings only!! here is a sample... #!/usr/bin/perl use Net::Ping; ...
7
by: patelxxx | last post by:
Guy's, On my homepage website I want to display the current status of our server. The idea I have is to ping (or send my ip address) to our server every 5 mins and the result I get back should...
3
by: imughal | last post by:
I got the perl script which does following task. This solution reads in a line from a text file that is passed in as input parameter 1 to a Perl script. This script will then ping the machine...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.