Help me to continue

Discussion in 'Perl' started by priyasub, May 1, 2009.

  1. priyasub

    priyasub New Member

    Joined:
    May 1, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    i need a help in executing a for loop... the output should be in the form as below
    1
    12
    123
    1234
    how to do it..
    im new to learn PERL Language..
    help me
     
  2. priyasub

    priyasub New Member

    Joined:
    May 1, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    i need a help in executing a for loop... the output should be in the form as below

    1234
    123
    12
    1


    how to do it..
    im new to learn PERL language
     
  3. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Code:
    #/usr/bin/perl
    
    for my $a (1..9)
    {
      print $_ for(1..$a);
      print "\n";
    }
    
    for(my $i=9;$i>0;$i--)
    {
      for(my $j=1;$j<$i;$j++)
      {
        print $j;
      }
      print "\n";
    }
    
    Btw, which programming language do you know?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice