The Elite Noob has asked for the wisdom of the Perl Monks concerning the following question:
And this is the error i have.#!/usr/bin/perl -w # vanillaPrimes.pl use strict; my $divider; # Used for testing file. open FILE, "<", "DATA1.txt" or die $!; # Open a file or return error. open oFILE, "+>>", "OUT1.txt" or die $!; # Used to write answer. my $numInput = <FILE>; # Getting the line from file. chomp($numInput); # removing a newline, just in case. my $half; if($numInput % $divider == 0){ $half = $numInput/2 } else { $half = ($numInput - 1)/2 } foreach($divider..$half){ if($numInput % $divider == 0){ print oFILE "not"; } else { print oFILE "prime"; } } close(FILE); close(oFILE);
syntax error at vanillaPrimes.pl line 13, near "){"
Execution of vanillaPrimes.pl aborted due to compilation errors.
This is line 13.
Thanks for the help, and please don't make a new script :) just help me with the error. Thanks!foreach($divider..$half){
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Simple Syntax Error? Can't Find?
by GrandFather (Saint) on Feb 26, 2011 at 00:03 UTC | |
|
Re: Simple Syntax Error? Can't Find?
by ikegami (Patriarch) on Feb 26, 2011 at 00:39 UTC | |
|
Re: Simple Syntax Error? Can't Find?
by BrowserUk (Patriarch) on Feb 26, 2011 at 00:04 UTC | |
|
Re: Simple Syntax Error? Can't Find?
by TomDLux (Vicar) on Feb 26, 2011 at 01:19 UTC | |
by The Elite Noob (Sexton) on Feb 26, 2011 at 02:11 UTC | |
|
Re: Simple Syntax Error? Can't Find?
by Anonymous Monk on Feb 26, 2011 at 00:18 UTC |