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

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