Use of Hash Arrays in PERL
create a file named "perl-tutorial-example-use-of-hash-array.pl" then copy and paste the below code:
print "\n\n";
print "ARRAYS IN PERL\n";
print "--------------\n";
# ARRAYS IN PERL
@Departments=("Enterprise & Financial System Mgt.", "Communication Solution Mgt.", "DBA");
print @Departments;
print "\n\n";
print "ACCESSING ARRAYS IN PERL\n";
print "------------------------\n";
# ACCESSING ARRAYS IN PERL
print $Departments[0], " , ", $Departments[2];
print "\n\n";
print "\n\n";
print "HASH ARRAYS IN PERL\n";
print "-------------------\n";
# HASH ARRAYS IN PERL
%Divisions=(
"OP" => "Operations",
"TH" => "Technology",
"CL" => "Commercials"
);
print %Divisions;
print "\n\n";
print "ACCESSING HASH ARRAYS IN PERL\n";
print "-----------------------------\n";
# ACCESSING ARRAYS IN PERL
print $Divisions{'OP'}, " , ", $Divisions{'TH'};
print "\n\n";
Use of Hash Arrays in PERL
Now run the program (perl-tutorial-example-use-of-hash-array.pl) from command prompt & get some interesting results as follows:

No comments:
Post a Comment
leave your comments here..