extract values from column with Perl

Hi everybody
I have some problems with PERL programming.

I have a file with two columns, both with numeric values.
I have to extract the values > 50 from the 2nd columns and sum them among them.
The I have to sum the respective values in the first column on the same line and, at the end, I have to divide the sum of the first column values for the sum of the second column values > 50.

Can you help me? the script must be in Perl language.
Thank you very much,
Have a good weekend
M.Elena

So as an example, you would have something like

1 20
3 40
7 60
8 90

The sum of the values in the second column which are larger than 50 is 60 + 90 = 150. The associated values in the first column are 7 + 8 = 15, so your answer is 15 / 150 = 0.1. Is that an accurate description of your problem?

Oh yes, It's alright Figaro!
Could you help me with a Perl script?

hi M.Elena,
here is the perl script which might help!!

#!/usr/bin/perl

$sum_col1=0;
$sum_col2=0;
while (<>)
{
  
  split(/ /);
  
 if ($_[1] > 50)
 {
     
    $sum_col2 += $_[1] ;
    $sum_col1 += $_[0] ;
 }
 
}
print("sum of col-2 is $sum_col2 \n");
print("sum of col-1 is $sum_col1 \n");

$rslt=$sum_col1/$sum_col2;

print("Answer is $rslt\n");
$ ./sol.pl ques 
sum of col-2 is 150 
sum of col-1 is 15 
Answer is 0.1

!!

I suppose "split(/ /);" does the delimiting? So if the delimiter is a semicolon (;), you would have "split(/;/);", correct?

exactly !!!!!!
when u write 'split()' alone, by default it assigns the splitted fields in built-in array @,
so u can access its contents as $
[0,1...].

Thank you very much not only for your help but, by your script, I understood something about Perl Language!

have a good day,
Maria Elena