Wednesday, October 5, 2016

Input and Output in Array in PERL

Here is a very short program that I wrote using PERL that will ask the user to give a series of  number store the given number by the user in array and display on the screen.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following 
jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.


Program Listing

#!D:\xampp\perl\bin

my @arr;
my $count =5;

$a=1;
print "\n\n";
print "\t\t Input and Output of Array in PERL";
print "\n\n";
 for ($a..5) {
    print "Enter value in item no. $a : ";
    my $num = <STDIN>;
    chomp $num;
    push @arr, $num;
    $a+=1;
}


print "\n\n";
print "The List of Values";
print "\n\n";
foreach (@arr) {
  printf "\t %s\n", $_;
}
print "\n";
print "End of Program";
print "\n";

No comments:

Post a Comment