D
\Dandy\ Randy
Hey everyone, I'm writting a simple script that takes data from a text file
and calculates percentages. Lets call this file "data.txt" In data.txt,
there are some numbers separated by "|" symbols like below:
2000|1800|500
I will open the file and get its data like this:
open (list, "<data.txt") or &error("Unable to open the data file for
reading");
$list=<list>;
close(list);
I will now split the data like this:
chomp ($list);
($total,$bought,$sold)=split(/\|/,$list);
Now I need help writting a set of commands that will calculate the
percentages of this data. I would like to have it in this format:
print "Total was $total";
print "Bought was $boughtpercentage"; # % of $bought vs $total
print "Sold was $soldpercentage"; # % of $sold vs $total
Can someone please help me with the commands to calculate $boughtpercentage
& $soldpercentage. Thanx to all who read or respond. Code examples are
greatly appreciated. TIA!!!
R
and calculates percentages. Lets call this file "data.txt" In data.txt,
there are some numbers separated by "|" symbols like below:
2000|1800|500
I will open the file and get its data like this:
open (list, "<data.txt") or &error("Unable to open the data file for
reading");
$list=<list>;
close(list);
I will now split the data like this:
chomp ($list);
($total,$bought,$sold)=split(/\|/,$list);
Now I need help writting a set of commands that will calculate the
percentages of this data. I would like to have it in this format:
print "Total was $total";
print "Bought was $boughtpercentage"; # % of $bought vs $total
print "Sold was $soldpercentage"; # % of $sold vs $total
Can someone please help me with the commands to calculate $boughtpercentage
& $soldpercentage. Thanx to all who read or respond. Code examples are
greatly appreciated. TIA!!!
R