in reply to input record separator and split

Where is

use strict;
???

--Chris

¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

Replies are listed 'Best First'.
Re^2: input record separator and split
by frednc_2014 (Initiate) on May 29, 2014 at 13:28 UTC

    Thanks for all the replies above. You pointed out correctly that the input record separator cannot take regular expression. If "\s+" is taken out, indeed, the array has only one (the last one) element because all the previous elements is replaced by the last one. But, if "\s+" is kept, the array has all the elements. If you run my split.pl above on this simple input file:

    Query= M01133:26:000000000-A6UCG:1:1101:22656:1128 1:N:0:1+@M01133:26:000000000-A6UCG:1:1101:22656:1128 2:N:0:1 Block1 Query= M01133:26:000000000-A6UCG:1:1101:22656:1130 1:N:0:1+@M01133:26:000000000-A6UCG:1:1101:22656:1130 2:N:0:1 Block2

    You'll see the array has two elements and they are the correct ones. The result is here:

    1 ---------------------- M01133:26:000000000-A6UCG:1:1101:22656:1128 1:N:0:1+@M01133:26:000000000-A6UCG:1:1101:22656:1128 2:N:0:1 block 1 2 ---------------------- M01133:26:000000000-A6UCG:1:1101:22656:1130 1:N:0:1+@M01133:26:000000000-A6UCG:1:1101:22656:1130 2:N:0:1 block 2

    Actually, it produced 3 elements. The first element was an empty one. I added a line of script to skip it.

    Chris, I ignored use strict, etc. just for testing this error. This split function is a part of my large script that worked perfectly until I got that particular input file. I just wrote a simple testing script to find out what the problem is

    Laurent, that particular line is just like all other lines at the same position, nothing special about it.

    By the way, I have two input files that do not work individually. However, if I combine them together to produce a larger file, the combined input file worked. That is strange.