C for statement version in Perl

Discussion in 'Perl' started by Kelly, Jun 18, 2004.

  1. Kelly

    Kelly Guest

    Hi,

    I want to do this, in C, this is how to do it

    for (i=0;i<4000;i++)
    .....write to a file...
    .....

    is there a function to write 4000 times to a file
    in perl?

    Thanks.

    kel
     
    Kelly, Jun 18, 2004
    #1
    1. Advertisements

  2. Kelly wrote:
    > I want to do this, in C, this is how to do it
    >
    > for (i=0;i<4000;i++)
    > ....write to a file...
    > ....
    >
    > is there a function to write 4000 times to a file
    > in perl?


    1) Exactly the same code will work in Perl, too.
    2) The more perlish style would be
    for my $i (0..3999) { write to a file}

    jue
     
    Jürgen Exner, Jun 19, 2004
    #2
    1. Advertisements

  3. Kelly

    Purl Gurl Guest

    Purl Gurl, Jun 19, 2004
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    1,052
  2. Jay McGavren
    Replies:
    11
    Views:
    1,452
    Alan Krueger
    Jan 16, 2006
  3. tedsuzman
    Replies:
    2
    Views:
    7,566
    Michel Claveau, résurectionné d'outre-bombe inform
    Jul 21, 2004
  4. Ted
    Replies:
    1
    Views:
    671
    Duncan Booth
    Jul 22, 2004
  5. Replies:
    21
    Views:
    1,381
    Giannis Papadopoulos
    Aug 2, 2005
  6. MowGreen [MVP]
    Replies:
    5
    Views:
    2,363
    PA Bear [MS MVP]
    Feb 9, 2008
  7. bthumber
    Replies:
    5
    Views:
    599
    Alexey Smirnov
    Jan 29, 2009
  8. Francesco Moi
    Replies:
    1
    Views:
    294
    Sisyphus
    Jul 27, 2003
Loading...