I have an initial file I read in. It is just a bunch of zeroes. Max will be 400, looking like this.
0
0
0
0
0
If a certain event occurs, I want to increment that postition by 1. Instead, my output looks like this
0
0
10
0
0
It appears to me it treats it aas a string and not as a number. How do I fix this?
# Here is my code to open the file
open(ASKED, "$asked_data"
;
@asked = <ASKED>;
close(ASKED);
# Needless to say there is a lot of other code inbetween, but here is where I ask my question. If it is true, I want the corresponding postion in the array given by $sequence to increase the number in $asked by one, i.e if is 0 become 1, if it is 1 become 2, etc..
if ($form{"$sequence[$i]"} eq $answers[$sequence[$i]] || $tick == 1) {
$correct++;
$num=$asked[$sequence[$i]];
$num++;
$asked[$sequence[$i]]=$num;
}
}
# The last thing I do is write it to a file
open(ASKED, ">$asked_data"
;
print ASKED @asked;
close(ASKED);
Thanks
Wim Libby
libbys@camalott.com
[sig][/sig]
0
0
0
0
0
If a certain event occurs, I want to increment that postition by 1. Instead, my output looks like this
0
0
10
0
0
It appears to me it treats it aas a string and not as a number. How do I fix this?
# Here is my code to open the file
open(ASKED, "$asked_data"
@asked = <ASKED>;
close(ASKED);
# Needless to say there is a lot of other code inbetween, but here is where I ask my question. If it is true, I want the corresponding postion in the array given by $sequence to increase the number in $asked by one, i.e if is 0 become 1, if it is 1 become 2, etc..
if ($form{"$sequence[$i]"} eq $answers[$sequence[$i]] || $tick == 1) {
$correct++;
$num=$asked[$sequence[$i]];
$num++;
$asked[$sequence[$i]]=$num;
}
}
# The last thing I do is write it to a file
open(ASKED, ">$asked_data"
print ASKED @asked;
close(ASKED);
Thanks
Wim Libby
libbys@camalott.com
[sig][/sig]