Hello. I'm trying to self learn Perl and am stuck. I have a data.csv file that contains the following:
5,10,15,20,15,30
1,2,3,4,5
3,10
11
I'm trying to get Perl to take the indexes and add them all together to get 134. It says I need to use split and invoke the file via
<> (built-in provides data from files and standard-in) the command line. So I'm doing ./test.pl data.csv to run it but I'm just
getting 4 lines containing a single 0. Any pointers?
Here is the code I have so far:
#!/usr/bin/perl
while (<>){
$total=(split/,/,$input);
print$total;
print ("\n");
}