Home arrow Perl Programming arrow Page 4 - Perl 101 (Part 2) - Of Variables And Operators

... Or Two Plus Two - Perl

Now that you've got the basics of the language down, this secondarticle in the series teaches you about Perl's variables and operators, andalso introduces you to conditional expressions.

TABLE OF CONTENTS:
  1. Perl 101 (Part 2) - Of Variables And Operators
  2. Q
  3. 2 2 ...
  4. ... Or Two Plus Two
  5. Comparing Apples And Oranges
  6. Decisions! Decisions!
  7. Handling The Gray Areas
  8. Miscellaneous Notes
By: Vikram Vaswani and Harish Kamath, (c) Melonfire
Rating: starstarstarstarstar / 6
June 01, 2000

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
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.

 
 
>>> More Perl Programming Articles          >>> More By Vikram Vaswani and Harish Kamath, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PERL PROGRAMMING ARTICLES

- Perl Turns 25
- Lists and Arguments in Perl
- Variables and Arguments in Perl
- Understanding Scope and Packages in Perl
- Arguments and Return Values in Perl
- Invoking Perl Subroutines and Functions
- Subroutines and Functions in Perl
- Perl Basics: Writing and Debugging Programs
- Structure and Statements in Perl
- First Steps in Perl
- Completing Regular Expression Basics
- Modifiers, Boundaries, and Regular Expressio...
- Quantifiers and Other Regular Expression Bas...
- Parsing and Regular Expression Basics
- Hash Functions

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: