Membandingkan,Memodifikasi Variabel (perl ) Part 3

print”NOT 85 is”, ~85, “\n”;
#membandingkan persamaan angka dalam perl
#dari hasil antara perbandingan tersebut 1=benar tidak ada hasil atau 0=salah

print”Lima lebih besar dari enam? “, 5 > 6, “\n”;
print “Tujuh lebih kecil dari enam belas? “, 7 1, “\n”;
print “Enam tidak sama dengan tujuh? “, 6 != 7, “\n \n”;

#boolean operator and(&&)

print”Test one: “, 6 > 3 && 3 > 4, “\n”;
print “Test two: “, 6 > 3 and 3 > 4, “\n \n”;

#Operator String dalam perl

print” \n Four sevens are “. 4+7 .”\n”;
print “go !” x3,”\n”; # bila menggunakan operator * dalam x3 maka dia menghasilkan nilai angka
print”an”.”na” x(3+2),”\n”;#dapat juga menggunakan penjumlahan dan yang lainnya untuk perulangan berkali kali
print”12 monkeys” +0 ,”\n”;
print “Eleven to fly” +0 ,”\n”;
print “UB40″ +0 ,”\n”;
print “-20 10″ +0 ,”\n”;
print “0x30″ +0 ,”\n \n”; #halaman 21

#Perbandingan String(String Comparison)
print”A # has ASCII value “, ord(“#”),”\n”;
print “A * has ASCII value “, ord(“*”),”\n \n”;

print”Which came first, the chicken or the egg? “;
print “chicken” cmp “egg”, “\n”;
print “Are dogs greater than cats? “;
print “dog” gt “cat”, “\n”;
print “Is ^ less than + ? “;
print “^” lt “+”, “\n \n”;

print “Test one: “, “four” eq “six”, “\n”;
print “Test two: “, “four” == “six”, “\n \n”;
#operator halaman 24

#variabel $(digunakan dalam variabel perl

$name = “dede”;
print “Nama saya adalah = “, $name, “\n \n”;

#modifikasi variabel

$name = “Anna”;
print “My name is “,
$name, “\n”;
print “It’s still “,
$name, “\n”;
$name = “aerdy”;
print “Well, actually, it’s “, $name, “\n”;
$name = “putra”;
print “No, really, it’s “,
$name, “\n \n”;

$a = 6*9;
print “6*9 = ” , $a, “\n”;
$b = $a + 3;
print ” a + 3 = “, $b, “\n”;
$c = $b / 3;
print ” b / 3 = “, $c, “\n”;
$d = $c + 1;
print ” c + 1 =”, $d, “\n”;
print “\nDi tulis kembali: “, $a, ” “, $b, ” “, $c, ” “, $d, “\n \n”;

# dilanjutkan lain kali ya…di perl4

Advertisements

Published by

jarcode

hello I am jarcode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s