in reply to Question on file I/O
Apart from that, you have a off-by-one error.
$#logme list the last index of @logme; you start $index at 0,
but the loop is while $index < $#logme, so the last item
in @logme will never get into OUTFILE2
it would be correct if you asked for the scalar value of
@logme, that gives you the # of items in @logme.