![]() |
Statement Blocks![]() ![]() ![]() ![]() ![]()
A statement block is a group of statements surrounded by curly braces. Perl views a statement block as one statement, The last statement executed becomes the value of the statement block. This means that any place you can use a single statement like the map function you can use a statement block. You can also create variables that are local to a statement block. So, without going to the trouble of creating a function, you can still isolate one bit of code from another. Here is how to use a statement block: The statement block serves to emphasize that the inner code is set apart from the rest of the program. In this case, the initialization of $secondVar is a bit more complex than the other variables. Using a statement block does not change the program execution in any way; it simply is a visual device to mark sections of code and a way to create local variables. Decision statements use the if keyword to execute a statement block based on the evaluation of an expression or to choose between executing one of two statement blocks based on the evaluation of an expression. They are used quite often. For example, a program might need to run one code section if a customer is female and another code section if the customer is male.
|
|
PERL Perl Program Data Types Types of Variables Operator Types Functions String Functions Array Functions Expressions Statement Blocks The if Statement Unless Statement While Loops Until Loop For Loop Foreach Loop Jump Keywords Subroutines Perl References Die Function Exit Function Localtime Function Standard Files File Test Operators File Functions Opening Files Reading into Hash Printing Revisited Globbing Splitting a Record into Fields Perl's Special Variables Regular Expression Simple True-False Searches Inexact Matches in Regular Expressions Matching Any Character Characters with Class Special Locations Quantifiers Greedy Matching Modifiers Localtime Function Subsituations Letter for Letter Translations Generating A Simple Report Defining a Report Template Specifying the Picture Line Specifying the Argument Line Adding a Header Writing the ReportDomain Names Home Importance of a domain name How does a web domain name work? Domain name syntax Choosing a domain name Domain Transfer Domain Parking IP AddressWeb Design HTML DHTML XML JAVASCRIPT VBSCRIPT PHOTOSHOPWeb Hosting Web Server Web Server Software Microsoft Internet Information Server Web hosting ISP Shared web hosting Virtual web hosting Dedicated web hosting Web hosting colocation Managed web hostingE Commerce Principles of E-Commerce E-Banking Electronic Payment System E-Security Credit Cards Smart Cards
The Mailbox POP Server SMTP Server IMAP Protocol |
| Home | Web Hosting | Web Design | Sitemap |
| Copyright (C) 2007. Web Domain design hosting. All rights reserved. |