473,800 Members | 2,332 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

135 New Member
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 1552
miller
1,089 Recognized Expert Top Contributor
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 New Member
Thank you again Miller.
Jun 12 '07 #3
miller
1,089 Recognized Expert Top Contributor
Your welcome

- Miller
Jun 12 '07 #4

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

Similar topics

14
5678
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 i can do that. Does anyone know a good way to make this happen? thanks a lot,
0
1673
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 xmlrpc ping server, but it is in perl and my client's system admin has moved away from perl. What my client wants: a real-time listing of blogs most recently
4
1930
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 comp.languages.php. Our IT staff who usually do this sort of thing are rather busy and I am desperately looking at an impending deadline. My organization's web page is on a server which has php. A work request web server is on a separate server...
3
7775
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
2269
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 that are even close the the actual ping command line utility. For example: If i would ping the same server over and over, some pings would come back in 0 milliseconds, others would come back in 15, but never in between. It would always jump...
14
42895
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
3241
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 respective server - via a specific port (2934 or 2935) to see whether the server is still "live", so the hosters don't have to manually update their status on the site. Everything I've seen seems overly complex. Efforts so far have returned info via...
1
1818
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; my $p = Net::Ping->new(`tcp`); open (TT, "box3");
7
1963
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 result (and display on my homepage) in a success or failure of the server. Can someone please help me with the coding for this or just start me off? Many Thanks in advance. Regards
3
8372
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 using TCP pings to the remote hosts echo port and will return up/down and the ping response time. A second optional attribute may be passed in that will set the default timeout for the ping response. Text file format: 127.0.0.0 localhost...
0
9691
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10253
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6813
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.