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


New operator => is equivalent to , and use if you feel it looks better
%hash = ( 'key1' , 'value1', 'key2' , 'value2' ); # perl4 is same as
%hash = ( 'key' => 'value1', 'key2' => 'value2' ); # perl5
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. 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 Sat Sep 6 1997