| Alfred Wong's Programming Showcase | ||||||||
|
array.cgi creates a reference to an anonymous array using square brackets. One way to deference is to use a scalar variable ($). Another way is to use the infix operator (->). See array.php for code and comments. See O'Reilly Perl documentation for more info.
hashtest.cgi replaces a value and reverses the keys and values. A print shows that you can't count on hashes being in any order. A loop then deletes two key/value pairs. See hashtest.php for code and comments.
listscalar.cgi shows differences between scalar and list context. See listscalar.php for code and comments. See Perl Paraphernalia for more info.
environment.cgi prints all environment variables in ascending key order. See environment.php for code.
sub.cgi uses @_, $_, and the conditional ternary operator in a subroutine. Subroutines get parameters in array @_. $_ is the default iterator variable. See Perl predefined variables for more info. The first element passed to returnValues is the compare value. If a later element > the compare value, the loop stacks it in an array, which the print method will print. See sub.php for code.
|
© 2004 Alfred Wong
|