I spent many years with Perl, but now PHP is my server-side language of choice. These days I think many folks would actually be learning JavaScript or another client-side language first! What I've always liked about PHP is its much easier syntax for complex data structures (and arrays in general). I don't have to keep referring to the Perl cookbook
I've also been writing quite a few bash scripts, mostly to provision and customize linodes. Most recently, as part of switching to Ubuntu from CentOS, I learned more about bashisms (because I had to write some init scripts, which are run with dash).
Looking very briefly at your tutorial, I noticed a few small things. Sorry my Perl is a bit rusty, though--
1. Love the -w and use strict!
2. You build an array with newlines appended to each part, which seemed a little odd.:
Code:
@grocery_list = ("apples\n", "oranges\n", "milk\n", "bread\n");
print @grocery_list;If you omitted the newlines, you could do things like:
Code:
print "@grocery list";
print join("\n", @grocery_list) . "\n";
3. The first loop you show is with for, I think foreach is simpler for most applications (since this is a beginners guide). You could even refer back to your grocery list to show how you could introduce some formatting.
4. You simply must introduce sanitizing user input when you get into the "dynamic content" section (you do mention it briefly). For example, If you expect numbers for input, remove everything else. We don't need more CGIs with injection and cross-site scripting problems.
This is a good time to talk about -T (taint) to identify such unsafe inputs. I wouldn't write any Perl-based Web interface without it.
I would also link people to a page like
http://www.owasp.org/index.php/Unvalidated_Input for details.
