Basic HTML version of Foils prepared Sept 20 97

Foil 5 Some Advanced Syntax in Perl

From Perl5 and Advanced Perl4 Features Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


New operator => for specifying keyword-value pairs:
%hash = ( 'key1', 'value1', 'key2', 'value2' );
# is equivalent to
%hash = ( 'key' => 'value1', 'key2' => 'value2' );
New operator -> is dereferencing operator
  • hard/soft reference to array reference -> [index];
  • hard/soft reference to hash reference-> {'key'};
  • class or object -> method;
In hash arrays, quotes are now optional if unambiguous, i.e. if couldn't be an expression
$days{'Feb'} and $days{Feb} are the same!



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Apr 5 1998