Basic HTML version of Foils prepared March 30 97

Foil 33 Basic Input (Chapter 6 of the Llama Book)

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


We have already seen how to read from standard input with
  • $line = <STDIN>; # returning next line INCLUDING terminal newline
  • @file = <STDIN>; # returning whole file with one line stored in each element of list @file
We can also easily access the arguments of a PERL program. Suppose you invoke a PERL program makePHD with
  • makePHD file1 file2 file3
Then we will see later how to access individual files file1, file2, file3 using standard argument conventions in UNIX
however the convention <> (Diamond Operator) will access the concatenation of the three files with all being read into array @argfiles with
  • @argfiles = <>;



© 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