Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Syntax Error

by idsfa (Vicar)
on Mar 19, 2006 at 06:08 UTC ( #537723=note: print w/ replies, xml ) Need Help??


in reply to Syntax Error

Those lines (26 & 27) should read:

} else {

Note the braces being flipped from the way you have given. If the book really has them that way, the book is wrong.

You can see this for yourself by realizing that for every opening brace, bracket or parenthesis, there must be a matching closed one. If your editor is too simple to help you keep them balanced, you should count them yourself (and get a better editor ;-).

The general syntax for an if loop in this case looks like:

if ( CONDITION ) { BLOCK OF COMMANDS } else { BLOCK OF COMMANDS }

Your example code has ifs within ifs, but still follows this pattern.


The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon


Comment on Re: Syntax Error
Select or Download Code
Re^2: Syntax Error
by djaesone (Initiate) on Mar 19, 2006 at 06:19 UTC
    AH! At my early stage in Perl understanding, I'm not sure even what the error message means, much less where to find the error in the script. But your response made total sense, and I appreciate your assistance with this.

      /boggle

      You'd find it on line 26, near the text "{ else".

      Doesn't get much simpler than that . . .

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://537723]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2014-10-31 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (216 votes), past polls