Perl Programming Page 4 - Perl 101 (Part 2) - Of Variables And Operators |
Of course, operators are not restricted to numbers alone - there are a couple of useful string operators as well. The string concatenation operator [.] is used to concatenate strings together, as in the following example: #!/usr/bin/perl $a = "The"; $b = "Incredible"; $c = "Shrinking"; $d = "Violet"; $result = $a . $b . $c . $d; print "Here's one possibility - $result\n"; $result = $c . $a . $b . $d; print "And here's another - $result\n"; And the string repetition operator[x] is used to repeat strings a specific number of times - take a look: #!/usr/bin/perl $a = "Loser!\n"; $insult = $a x 7; print($insult); Talk about using your powers for evil... This article copyright Melonfire 2000. All rights reserved.
blog comments powered by Disqus |