Missing semicolon after the line: my ($num) = @_ so it should be my ($num) = @_; Tristan J. Meisters wrote: > Hello! I hope that I don't offend anyone with this question as I am sure > that it has a very simple solution. I am working my way through Learning > Perl and I just wrote up a short program for one of their problems. When I > try to run it however I get the error > > "# syntax error, near "}" > File 'boot:The Brain:Learning Perl Projects:Problem 8-1'; Line 15 > # boot:The Brain:Learning Perl Projects:Problem 8-1 had compilation errors." > > I have looked through the code and I cannot find anything that is > syntacticly wrong with the code, especially right before the else block. I > seem to remember having the same problem once before when I was using the > else clause. Anyway, below is a copy of my code, any help would be greatly > appreciated. > > cheers Tristan > > #!perl -w > > use strict; > > my $num ; > > sub num_return { > my %equiv ; #initalize the lookup table > @equiv{1..9} = qw (one two three four five six seven eight nine); > # define the values > > my ($num) = @_ #initalize the look-up number > > if ($equiv{$num}) { # test if number is defined > return $equiv{$num}; > } else { > return $num; > } > } > > while (<STDIN>) { > print ("The written equivalent of $num is num_return($num) !\n"); > } > > ___________________________ > Tristan J. Meisters The Pas, MB Canada mailto:rmeister@pop.mts.net > Web Designer/Programmer http://www.mts.net/~rmeister/ > > >From the Ferengi Rules of Acquisition: > #34 "Peace is good for business." > #35 "War is good for business." > > ***** Want to unsubscribe from this list? > ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch