Basic HTML version of Foils prepared March 30 97

Foil 22 Arrays and Lists of Scalars(data) VII -- Printing (Chapter 3 of Llama Book)

From PERL4 Tutorial for CPS616 Computational Science for Information Age Course CPS616 -- February 1995. by Geoffrey C. Fox


The argument of print is just a list or array and so
  • print "Hello"," Rest", "of World"; # or
  • print @fred; # are legal
One can read in a whole array to a list where each entry of list is one line of file. For instance one can set @file to be all of standard input by:
  • @file = <STDIN>; # We will learn how to do for arbitrary files
As mentioned, double quoted strings use variable interpolation for arrays as in
  • $string = "This is a full list @fred \n";
  • $string = " First value in fred list is $fred[0] \n";
  • Slices and variable indices can also be used in variable interpolation



© 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