in reply to Error: Use of uninitialized value $item in concatenation (.) or string at...
For every match your are setting array index 0 in one if-clause, index 1 and 2 in another if-clause and index 3,4 and 5 in a third if-clause. Now if for example the first if-clause doesn't match, index 0 will be undef, but the other indexes will have data in it. Same for the second if-clause.
The solution depends on what your script does
if every match needs all 6 data items to be there, you have to restructure your code. If the first 'if' succeeds, any following 'if' should be inside that if and not matching should result in an error message (or in refuting that match)
If incomplete data in a match is normal you could either just use your "if defined" solution or push data onto your array instead of setting it. i.e.
#instead of $one_match_ref->[3] = $1; $one_match_ref->[4] = $2; $one_match_ref->[5] = $3; #use push( @{one_match_ref},$1,$2,$3 );
That way no holes are generated in your arrays
|
|---|