Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Operators: arithmetic and otherwise

by root (Scribe)
on Nov 17, 1999 at 01:12 UTC ( #990=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    print $a.$b   #string operator prints 2 plus the three or 23
    print $a*$b   #arithmetic operator prints 6
    print $a x $b #string operators prints $a $b times or 2 three times. i
    +e 222
  2. or download this
    $a-=2;     #$a=$a-2; $a is now equal to 3;
    $b x=3;    #$b=$b x $3 $b is now equal to "xxx";
    $b .="33"; #b=$b."33"  $b is now equal to "xxx33";
  3. or download this
    print $a++; #prints a as one then adds 1 to it
    print $a;   #now $a is 2
    print ++$a; #adds one to $a and then prints its value which is now 3;
    print $a--; #prints 3 then subtracts one from $a;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://990]
[chacham]: Just paint the white house black again.
dbander snorts
LanX Gesundheit! :)
talexb wonders about dividing developers in those born before the Unix timestamp of zero .. and after. Spoiler: I'm before.
chacham remebers I am a mad scientist
[stevieb]: talexb I'm after by a few years, but we can still be friends because you live in my hometown ;)
[LanX]: White House

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2017-08-18 13:26 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (302 votes). Check out past polls.