कंप्यूटर प्रोग्रामिंग/वेरिएबल/पर्ल
variables.pl
सम्पादनprint "Variables and Data Types\n";
$i = 12345;
$f = 1.23456789012345;
$s = "string";
print "int: $i\n";
print "float: $f\n";
print "string: $s\n";
print "\n";
print "Constants\n";
print "Perl doesn't support constants.\n";
print "\n";
print "Arithmetic Operators\n";
$a = 3;
$b = 2;
print "a = $a\n";
print "b = $b\n";
print "a + b = " . ($a + $b) . "\n";
print "a - b = " . ($a - $b) . "\n";
print "a * b = " . ($a * $b) . "\n";
print "a / b = " . ($a / $b) . "\n";
print "\n";
print "Assignment Operators\n";
$a += $b;
print "a += b is $a\n";
$a -= $b;
print "a -= b is $a\n";
$a *= $b;
print "a *= b is $a\n";
$a /= $b;
print "a /= b is $a\n";
print "\n";
print "String Concatenation\n";
$s1 = "Hello";
$s2 = "world";
print $s1 . " " . $s2 . "!\n";
print "\n";
print "User Input\n";
print("What is your name? ");
$name = <STDIN>;
chomp($name);
print "Hello $name!\n";
कोशिश करो
सम्पादननिम्न कोड मुफ्त ऑनलाइन विकास के वातावरण में से एक में ऊपर कॉपी और पेस्ट करो या अपने खुद के कम्पाइलर/इंटरप्रेटर/आईडीई का उपयोग करें।