Hello Monks, I am attempting to set the value of blank elements in an array to zero. How can I do this? The input looks like this:
Thurs,July,5,2012,123,456,789
Thurs,July,5,2012,123,456,789,Fri,July,6,2012
Here is my code
my $line;
my ($dow,$mon,$day,$year,$num1,$num2,$num3,$dow2,$mon2,$day2,$year2) =
+ "";
foreach $line (@array){
($dow,$mon,$day,$year,$num1,$num2,$num3,$dow2,$mon2,$day2,$year2)
+= split /[,]/, $line;
print "$dow2\n";
I would like to be able to print $dow2 through $year2 but I am getting the error "Use of uninitialized value $dow2 in print..." What am I doing wrong here?