{
and }
) are used to
group blocks of statements together.
Pattern matching and substitution, one of perl's greatest
strengths, uses a syntax very similar to sed's.
Perl uses the same mechanism for comments as do the shell scripts, namely
any text appearing on a line after a pound sign (#
) is treated as
a comment. And like shell scripts, perl statements are executed when they
are encountered in a program, not when some particular function (like
main() in C) is invoked.
Besides the constructs borrowed from shell scripts, awk and sed, perl is primarily a functional language - you accomplish tasks by calling functions, which either do what you want, or return a value which you can store in a variable, and further manipulate. Thus, one good way to write perl programs is to identify the key tasks you need to perform and either find existing functions to do those tasks, or to write the functions yourself. Writing functions in perl is very similar to writing ordinary programs, and in this way, perl encourages modular programming.
Perl is also capable of producing object-oriented programs. In object oriented programs, certain data is marked as belonging to a particular class (``blessed'' in perl lingo), and methods are written to operate on that data. While perl provides the tools to produce object-oriented programs, you never need to write your programs this way. Like so much else in perl, it is one of many options available to you when trying to solve a particular problem.