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


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

in Table To:


© 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