Hi Guys
I have perl code that looks like this:
sub test_score { $SCORE = @_; for($i=0;$s<=100;$i++) { ... ... ... ... my @SCORES = split(/ /,$scores); push @{${$SCORE}[$sentence]},[EMAIL PROTECTED]; } }
my @SCORE =(); &test_score([EMAIL PROTECTED]);
$scores is a string separated by whitespace, @SCORE is an array. How would I access this array in C? I am not really clear on what that last 'push' statement is doing?
I'm not sure which array you want to access in C - but this demonstrates what the last push is doing:
use warnings;
@zero = (0,0,0,0); @one = (1,1,1,1); @two = (2,2,2,2); @three = (3,3,3,3); @init = ([EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]);
$sentence = 2; @SCORES = (9,8,7,6,0); $SCORE = [EMAIL PROTECTED];
# Push a reference to @SCORES onto the array # referenced by $init[$sentence] - ie $init[2] # - ie @two.
push @{${$SCORE}[$sentence]},[EMAIL PROTECTED];
# Now @two = (2,2,2,2,[EMAIL PROTECTED])
for(0..3) {print $two[$_], " "} print "[EMAIL PROTECTED]";
Cheers, Rob