CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Perl program that accepts integer argument: Edit Log


May 25, 2017, 1:19 AM

Views: 1862
Perl program that accepts integer argument

Hello there. I have no idea about the reverse function so I did a research through the internet. My code doesn't work well when I try to execute it on the terminal.

The instruction is written inside.

use strict;
use warnings;

Write a perl program that will accept an integer argument
and output the example below,
use any kind of loops you prefer.

Example: 5
5 4 3 2 1

if(@ARGV > 0) {
print "@ARGV\n";
foreach my $i (reverse(0..$#ARGV)) {
print "Boom!!\n";

Can you guys tell me what's wrong with this one? I know that there's something wrong because the output appears as:

$ ./ 5 

instead of the output that was shown inside (comment) of the code.

thanks in advance.

(This post was edited by iammgg on May 25, 2017, 1:29 AM)

Edit Log:
Post edited by iammgg (Novice) on May 25, 2017, 1:21 AM
Post edited by iammgg (Novice) on May 25, 2017, 1:29 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives