Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^4: How do I remove spaces between sequences in a file

by bingalee (Acolyte)
on Jun 20, 2013 at 15:19 UTC ( #1039991=note: print w/ replies, xml ) Need Help??


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 :)


Comment on Re^4: How do I remove spaces between sequences in a file
Download Code
Re^5: How do I remove spaces between sequences in a file
by davido (Archbishop) 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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039991]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-07-30 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (231 votes), past polls