Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Strange finish!!

by graff (Chancellor)
on Nov 07, 2007 at 08:54 UTC ( [id://649432]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Strange finish!!
in thread Strange finish!!

Following on what duff said, the "statement terminator" is either a semi-colon, end-of-block, or end-of-file. The semi-colon is actually a "statement separator", so when you want two or more statements in a perl script or block (which is just about always), you need to put semicolons between them.

Spaces, tabs and newlines (when they are not enclosed in any sort of quotation marks) are only useful as token separators (they are often "optional" in this role). Of course, they also serve as aids to human readability, but they only have a functional syntactic role when they are required as token separators (e.g. you must have whitespace between "use" and the name of a module or pragma), and in those cases, spaces, tabs and newlines are interchangeable -- perl doesn't care what kind of whitespace you provide, so long as you put it where it's needed:

#!/usr/bin/perl # (shebang line syntax is dictated by unix shell) use strict;use warnings;my @a = qw (1 2 3);print "@a\n"

Replies are listed 'Best First'.
Re^4: Strange finish!!
by Limbic~Region (Chancellor) on Nov 07, 2007 at 14:34 UTC
Re^4: Strange finish!!
by blazar (Canon) on Nov 08, 2007 at 12:47 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-03-28 13:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found