> everytime the section is reset and the loop starts to write into the array the first iteration is lost
It's not lost, it's missed by your script. Every iteration of the loop reads one line from the array. Even the execution of the outermost "else" part processes one line - and it's supposed to be the /^t/ line. That's why I suggested to move the check there.
Another option would be to add a
redo
as the last command in the outermost else, to restart the loop without reading a line.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
| [reply] [d/l] [select] |
I fixed it with, for some reason it went to this section after matching t the second time and cleared the array.
}
$backin = shift(@section);
undef(@section);
push(@section,$backin);
}
}
close ($fh);
exit;
| [reply] [d/l] |
I'm not sure how it solves you problem, but a shorter way to write the same is
@section = shift @section;
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
| [reply] [d/l] [select] |