|
Let say I read data from a file into a variable like so:
$f='31,84,18,135,86'; and I want to find the sverage number in the variable $f how would I do this, also if I can read each line in a text file into a different varable like:
$a='31';
$b='84';
etc
then I would do it that way, or if I could read it into an array I could do that but I dont know how to do any of these things, so I have a file that looks like this:
1
8
4
9
10
3
6
etc
it only has numbers 1 to 10 and I want to read it and find the average and display the average, how would I do this, I prefer code, but if you can give me the functions that works also.
|