June 2005
Beginner
480 pages
10h 31m
English
The fundamental way to group statements in Perl is the block. To group statements in a block, just surround the statements with a matched set of curly braces, as shown here:
{
statement_a;
statement_b;
statement_c;
}
Within the block, statements execute from the top down, as they have until now. You can have other, smaller blocks of statements nested within a block, as you can see here:
{
statement_a;
{
statement_x;
statement_y;
}
}
The format of the block, like the rest of Perl, is free-form. The statements and curly braces can be on one line or on several lines, as shown here, and with any kind of alignment you want, as long as you always have a matched set of curly braces:
{ statement; { another_statement; }
{ last_statement; } ...Read now
Unlock full access