Reading the first two paragraphs of perlsyn, I've noticed there is more information in there about sed, awk, C and command line switches than introductory perl syntax. A Perl script consists of a sequence of declarations and statements.
The sequence of statements is executed just once, unlike in sed
and awk scripts, where the sequence of statements is executed
for each input line. While this means that you must explicitly
loop over the lines of your input file (or files), it also means
you have much more control over which files and which lines you look at.
(Actually, I'm lying--it is possible to do an implicit loop with
either the -n or -p switch. It's just not the mandatory
default like it is in sed and awk.) Perl is, for the most part, a free-form language. (The only exception
to this is format declarations, for obvious reasons.) Text from a
"#" character until the end of the line is a comment, and is
ignored. If you attempt to use /* */ C-style comments, it will be
interpreted either as division or pattern matching, depending on the
context, and C++ // comments just look like a null regular
expression or defined-or operator, so don't do that.
What is this actually teaching?
This quantifies like so:
Obviously a hold over from the days when Perl was just a replacement for awk and sed and Real Programmers coded in C. While this information might be useful, the opening paragraphs of the Perl syntax documentation is not the place to put it.
It's useful information, but you're right, it doesn't belong in an introductory document. It might be more appropriate in perltrap, for instance.
In the same vein, I keep thinking there's a lot of documentation, but it's hard to skim because it's all one flat structure. (How many people remember what's in perldsc?) It would be nice to have it arranged into groups, maybe something like:
I'd gladly make and maintain such a list, but I don't know how to get it out there. Give it to you?
Re:Reorganize rather than re-write
schwern on 2003-05-14T22:58:56
5.8.0's perl(1) already does that breakdown, pretty much exactly along those lines.
As an aside, the formatting on perldoc.com is quite nice.