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
- #!/usr/bin/perl
- use warnings;
- use strict;
- use Net::SMTP;
- ## Declare variables ##
- my $position_file="/radiuslog/radius.log";
- my $logFile="/radiuslog/radius.log";
- my $outputFile="/radiuslog/output.log";
- my $Subject="radius Error";
- my $position=0;
- my ($newpos,$count,$msg)=qw(0 0 '');
- ## Open input and output files ##
- if ( [ -f "$position_file" ] ) {
- open (POS,"$position_file") || die "Unable to open position file: $!\n";
- $position=<POS>;
- chomp($position);
- close (POS);
- }
- open(LOG,"$logFile") or die "Unable to open logfile:$!\n";
- open(OUT,">$outputFile") or die "Unable to open output file:$!\n";
- if (seek(LOG,$position,0) )
- ## Call functions ##
- while (<LOG>) {
- chomp();
- if ( /WARNING: Child is hung for request/) {
- $count+=1;
- print OUT "$_\n";
- }
- }
- $newpos=tell(LOG);
- open (POS,">$position_file") || die "Unable to open position file $position_file
- for writing:$!\n";
- print POS "$newpos\n";
- close(POS);
- if ( $count=>50 ) {
- sendMail();
- $count=0;
- }
- ## Function to send out mail ##
- sub sendMail {
- $msg = new MIME::Lite;
- $msg->build(
- Type =>'text',
- Path =>"cat $outputFile |",
- ReadNow => 1
- );
- $msg->add(From =>"<email>");
- $msg->add(To =>"$ARGV[0];");
- $msg->add(Subject => "$Subject");
- }
- ## Function to filter logs ##
- sub logFilter
- #open(LOG,"/radiuslog/radius.log") or die "Unable to open logfile:$!\n";
- {
- while(<LOG>)
- {
- if(($_ =~ /WARNING: Child is hung for request/) )
- {
- next;
- }
- print OUT;
- }
- close(LOG);
- close(OUT);
- }