Basic HTML version of Foils prepared
March 30 97
Foil 8 Operators for Numbers and Strings I (Chapter 2 of Llama Book)
From
PERL4 Tutorial for CPS616 Computational Science for Information Age Course CPS616 --
February 1995
.
by
Geoffrey C. Fox
Convential arithmetic operators are available in PERL
+, -, =, /, ** (last is raise to power of) mean what you think
2+3 # is 5
10/3 is 3.33333 (and not 3) as numbers are floating point if necessary
One important string operator is . for concatenate
"Hello" . " World" is identical to "Hello World"
Less used is x (times) used to replicate string data
"hip " x 3 . "hurrah" # is "hip hip hip hurrah
Note that (3+2) x (3+1) # is NOT a number but rather the string "5555"
©
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