Basic HTML version of Foils prepared April 16,1996

Foil 5 Some Advanced Syntax in Perl

From Perl5 and Advanced Perl4 Features Computational Science for Information Age Course CPS616 Material -- April 16,1996. by Geoffrey C. Fox


1 New operator => is equivalent to , and use if you feel it looks better
2 %hash = ( 'key1' , 'value1', 'key2' , 'value2' ); # perl4 is same as
3 %hash = ( 'key' => 'value1', 'key2' => 'value2' ); # perl5
4 New Operator -> is dereferencing operator
  • hard/soft reference to array reference -> [index];
  • hard/soft reference to hash reference-> {'key'};
  • class or object -> method;
5 in hash arrays , quotes are now optional if unambiguous i.e. couldn't be an expression
6 $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 Sat Sep 6 1997