in reply to Re^3: How do I remove spaces between sequences in a file
in thread How do I remove spaces between sequences in a file

Hey Dave, that's EXACTLY what I wanted. Thank you so much :D. This is the code I used,

for($i=1;$i<=scalar(@detail);$i++) { print OUT "$detail[$i-1]"; if($i%59==0) { print OUT "\n"; } }

but yours looks worked too. thanks :)

Replies are listed 'Best First'.
Re^5: How do I remove spaces between sequences in a file
by davido (Cardinal) on Jun 20, 2013 at 15:24 UTC

    It's an interesting choice that you decided to produce an off-by-one error in the generation of indexes in your loop control, and then remove it by subtracting one from the array indexing. Using a C-style loop you could have done this:

    for( my $i = 0; $i < @detail - 1; $i++ )

    ...or better...

    for( my $i = 0; $i < $#detail; $i++ )

    ...or even...

    foreach my $i ( 0 .. $#detail ) {

    Dave