After your 1st split, $content[0] contains the string 2009-12-24_, as desired. Then you split that string on the underscore character. The resulting array, @datesplit, now has only one element. The problem arises because you expected that array to contain (at least) two elements in your next line:2009-12-24_,5587
If this line represents valid input data, then you must check how many elements are in your @datesplit array if you want to avoid this warning. Perhaps you want to do something like this:$csvprint = "$datesplit[0],$datesplit[1],$content[1]\n";
if (@datesplit > 1) { $csvprint = "$datesplit[0],$datesplit[1],$content[1]\n"; } else { $csvprint = "$datesplit[0],$content[1]\n"; }
In reply to Re: reading files in a directory with range operator.
by toolic
in thread reading files in a directory with range operator.
by avanta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |