I am writing a perl script for some experiments i am doing and for some reason the compiler is spitting out a bunch of errors. To be exact:
syntax error at expRepeat.pl line 30, near "1;"
syntax error at expRepeat.pl line 31, near "++ )
"
syntax error at expRepeat.pl line 39, near "}"
could someone please explain whats going wrong. Here is the code
#!/usr/bin/perl -w
#Author: Austin Miller
# This program is to run experiments
# of the same length and same type
# multiple times
use strict;
use warnings;
use diagnostics;
use sigtrap;
use Getopt::Long;
use Config;
use IPC::Open3;
use Net::SSH::Perl;
use HTTP::Date;
###################
my $expName = 'PB40DD20'; #Group of experiment names followed by trial ex. EXPNAME_trial
my $fileName = 'SRConfig.conf';
my $repeatAmount = 10; #how many trials should we run
my $time = 11; #Amount of time to run each experiment
my $searchPort = 4185;
my $seperator = '_'
###################
for (my$counter = 1; $counter <= $repeatAmount; $counter++ )
{
print "Change our ports.\n";
changePorts();
my $newExpName = $expName.$seperator.$counter; #concatonated exp name
print "Starting experiment: $newExpName \n";
`perl ExecuteSeer32.pl -component all -command runall -time $time -exp $newExpName`;
print "Experiment $newExpName complete.\n";
sleep(30);
}
sub changePorts
{
my @fileContents;
my $replacePort;
my $line;
open(FILE, "$fileName") or die("Can't open file!"); #open for reading
@fileContents = <FILE>; #dump all file contents into temp array
close FILE; #close original file
$replacePort = $searchPort + 1; #change the port by one
open(FOUT, ">$fileName") or die("Can't open file to rewrite!"); #open file for writing
foreach $line (@fileContents) #go line my line
{
$line =~ s/$searchPort/$replacePort/g; # search for old port and replace with new one
print FOUT $line; #write to file
}
close FOUT; #close new file
$searchPort++; #make new port old port
}

New Topic/Question
Reply


MultiQuote





|