On Wed, Dec 15, 2004 at 04:50:03PM -0500, Nitin Madnani wrote:
> Hi Guys
> 
> I have perl code that looks like this:
> 
> sub test_score {

>    $SCORE = @_;

Is this directly from existing code?
If so its probably not doing what its ment to
do as SCORE now contains the number of arguments
passed in(then again maybe thats what you want).

>    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?

The Array Manipulation Functions section of the perlapi man pages deals
with getting and setting elements of an array but first you need to
dereference the array ref using(I think) SvRV. This is documented(briefly)
in the SV Manipulation Functions section of perlapi.

>I am not really clear on what that last 
> 'push' statement is doing?

It is adding a reference to the SCORES array to the array pointed to
by the $sentence th element of the array pointed to by $SCORE.
(there is probably a better way to say that).

I usually use something more like :

push( @{ $scores->[$sentence] } , [EMAIL PROTECTED] )

as I find it clearer.

> 
> Thanks a lot !!
> Nitin

-- 
Our challenge is to proactively coordinate excellent benefits while continuing 
to dramatically revolutionize unique intellectual capital while maintaining 
the highest standards

Reply via email to