Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Syntax Error

by idsfa (Vicar)
on Mar 19, 2006 at 06:08 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://537723]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 23:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found