Syntax Conventions
Perl uses non-alphabetic characters to introduce various kinds of
program entities
(i.e. set a context in which to interpret identifiers).
Char |
| Kind |
| Example |
| Description |
# |
| Comment |
| # comment |
| rest of line is a comment |
$ |
| Scalar |
| $count |
| variable containing simple value |
@ |
| Array |
| @counts |
| list of values, indexed by integers |
% |
| Hash |
| %marks |
| set of values, indexed by strings |
< |
| Handle |
| <STDIN> |
| input on file |
& |
| Subroutine |
| &doIt |
| a callable piece of Perl code (the & is optional) |
cf. PHP where $ introduces all typs of variables, and handles are values.
|