Basic HTML version of Foils prepared Sept 20 97

Foil 10 Operators for Numbers and Strings I

From Tutorial on PERL Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


Conventional arithmetic operators are available in PERL
  • +, -, =, /, ** (latter 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 Sun Sep 21 1997