Perl
Tom Kelliher, CS 318
Jan. 21, 1999
Find three Perl resources on the Web and e-mail the URLs to me by 1:20pm on
1/24/00.
Threw around some course structure ideas.
- Perl: mechanics, variables, control, I/O, subroutines.
- Perl lab.
More Perl.
- Phoenix accounts.
- Editing.
- Perl file extension:
.pl
.
- Making a Perl script executable:
chmod
.
- Documentation and readability.
- The ``magic'' line:
#!/usr/local/bin/perl -w
Why -w
? Debugging help
-
use strict;
and my
. Global vs. local variables.
- Scalars.
- Arrays/Lists. ``Length.'' Indexing as a scalar.
- Blocks. Scoping.
- Conditions.
- If/Else. Elsif.
- While, for.
- STDIN, STDOUT, STDERR.
- Open(), close(), file handles.
- Line input with
<FILEHANDLE>
-
getc [FILEHANDLE]
- Prototype declaration.
- Definition:
sub foo
{
...
}
- Parameter ``passing.''
- Parameter list in
@_
.
- Get next parameter:
$foo = shift(@_);
Add a subroutine to cat.pl.
Thomas P. Kelliher
Fri Jan 21 12:09:38 EST 2000
Tom Kelliher