Friday, April 22, 2011

Perl for the day: Assigning variables

use strict;
use warnings;

# scalar

my $number = 72;
my $strin = "kutti";
my $cha = 'a';

# array

my @arr = (34,56,78,90);
my @sarr = ("amm ", "app ", "tha ", "akk ", "mam ", "kul ", "jai ", "all ");
my @carr = ('a','b','c','d');

print $number,"\n";
print $strin,"\n";
print $cha, "\n";

print $arr[3],"\n";
print $sarr[4],"\n";
print $carr[3],"\n";

print @sarr[4, 5, 6],"\n";
print @carr[0, 1, 2, 3],"\n";

No comments:

Post a Comment