473,513 Members | 2,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

perl script error

1 New Member
Hi,

I am getting the following error when i try to run the perl code

syntax error at new.pl line 26, near ")

## Call functions ##
while"
syntax error at new.pl line 32, near "}"
Execution of new.pl aborted due to compilation errors.

Can some one help me what was wrong

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use warnings;
  4. use strict;
  5. use Net::SMTP;
  6.  
  7. ## Declare variables ##
  8. my $position_file="/radiuslog/radius.log";
  9. my $logFile="/radiuslog/radius.log";
  10. my $outputFile="/radiuslog/output.log";
  11. my $Subject="radius Error";
  12. my $position=0;
  13. my ($newpos,$count,$msg)=qw(0 0 '');
  14. ## Open input and output files ##
  15. if ( [ -f "$position_file" ] ) {
  16. open (POS,"$position_file") || die "Unable to open position file: $!\n";
  17. $position=<POS>;
  18. chomp($position);
  19. close (POS);
  20. }
  21. open(LOG,"$logFile") or die "Unable to open logfile:$!\n";
  22. open(OUT,">$outputFile") or die "Unable to open output file:$!\n";
  23. if (seek(LOG,$position,0) )
  24.  
  25. ## Call functions ##
  26. while (<LOG>) {
  27.         chomp();
  28.         if ( /WARNING: Child is hung for request/) {
  29.                 $count+=1;
  30.                 print OUT "$_\n";
  31.         }
  32. }
  33. $newpos=tell(LOG);
  34. open (POS,">$position_file") || die "Unable to open position file $position_file
  35.  for writing:$!\n";
  36. print POS "$newpos\n";
  37. close(POS);
  38.  
  39. if ( $count=>50 ) {
  40. sendMail();
  41. $count=0;
  42. }
  43.  
  44. ## Function to send out mail ##
  45. sub sendMail {
  46.  
  47. $msg = new MIME::Lite;
  48.  
  49. $msg->build(
  50.  
  51.       Type =>'text',
  52.       Path =>"cat $outputFile |",
  53.       ReadNow => 1
  54.  
  55. );
  56.  
  57.       $msg->add(From =>"<email>");
  58.       $msg->add(To =>"$ARGV[0];");
  59.       $msg->add(Subject => "$Subject");
  60. }
  61. ## Function to filter logs ##
  62. sub logFilter
  63.  
  64. #open(LOG,"/radiuslog/radius.log") or die "Unable to open logfile:$!\n";
  65.    {
  66.  
  67. while(<LOG>)
  68.  
  69.    {
  70.  
  71.              if(($_  =~ /WARNING: Child is hung for request/) )
  72.  
  73.     {
  74.  
  75.              next;
  76.  
  77.      }
  78.   print OUT;
  79.  
  80. }
  81. close(LOG);
  82. close(OUT);
  83. }
  84.  
Dec 30 '10 #1
1 1775
numberwhun
3,509 Recognized Expert Moderator Specialist
You have the following line right before the while statement:

Expand|Select|Wrap|Line Numbers
  1. if (seek(LOG,$position,0) )
  2.  
That is clearly not a valid if statement. These are the things that strict and warnings catch. Thank you for using them!

Regards,

Jeff
Dec 30 '10 #2

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

Similar topics

3
15271
by: FLOTServer | last post by:
Here's my problem: I run a gameserver that runs the game "Medal of Honor". On the game server is log file which contains all of the data from the players for that day (kills, deaths, etc...). I...
3
4934
by: PzYon | last post by:
Hey 2gether! I'm trying to execute a PERL script on the web server when the user presses a button in an ASP.NET Web Application using Visual Basic. The most obvious solution for me seemed to be...
4
3743
by: benwylie | last post by:
I am running IIS 6.0 on Windows 2003. I would like to be able to run a perl script from a web page and include the output. I have tried doing it with an ssi: <form action='docsearch.shtml'...
9
20878
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at...
1
1627
by: Balajisanthanakrishnan | last post by:
Old Title: Hi all, need help for this perl script- thanks in advance I am BalajiSanthanakrishnan, chennai. Now I am working in a Perl Script which is executing in the Unix Servers. Basically i am...
2
4029
by: kimonp | last post by:
I am running on windows XP with a fresh install of wamp5 (1.7.2) and mediawiki. I am trying to call a perl function from within php using proc_open. The perl script is being executed and...
3
4016
by: tundal45 | last post by:
Hey Guys, I am trying to automate the process of loading data in our oracle server. As a part of that process, I am working on a perl script that loads external tables from data files. What I am...
3
8059
by: vijayarl | last post by:
Hi all, i have perl script, which is used to send mail. its a command line utility. if we run this perl script in command line by passing all it's required arguments, it works very well.there no...
82
9956
by: happyse27 | last post by:
Hi All, I modified the user registration script, but not sure how to make it check for each variable in terms of preventing junk registration and invalid characters? Two codes below : a)...
0
2047
by: somsub | last post by:
Hi All, I am facing a problem while running a perl script through selenium RC server . I recorded oone log in test case with slenium IDE and run it after that with the ide only and it worked...
0
7265
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
7171
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
7545
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...
1
7111
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
7539
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...
1
5095
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4751
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...
0
1605
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 ...
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.