--- David Greenberg <[EMAIL PROTECTED]> wrote:
> I'm sure there's an easier/better way of doing this, > but in the interest of > simplicity, let's look at this approach: > > First, a red flag goes up when you say that you have > an array of 12 > numbers. Will it always be twelve? > > The second red flag is that you are splitting the > array into quarters based > on the fact that you need the calculations done for > every three numbers. > Again, will this always be three? Why? More > importantly, why are they not > already in separate lists/arrays? > > Enough of that. Here is a simple solution for > splitting the arrays up: > > use strict; > use Statistics::Lite > # Takes a reference to an array and returns a list > of references to arrays. > sub arr_split { > my @arr = @{shift(@_)}; > my @new_arr = (); > Hi David, I have text files containing 96 lines/records for each and each line contains several columns. Only one colummn for each line is printed out in 12x8 format in a hard copy, which is what I want. But I can't transfer data in hard copy (in 12x8 format) to excel direclty. One way to do that is to enter each piece of desired data one by one based on the hard copy, which means mistake might easily arrise and is very tedious when dealing with many files. So I build a one-dimension array with 96 elelments out of one file based on my understanding and the inputs from the list. >From the array I print out the results in 12x8 format using nested loops to make sure what I get is consistant with the hard copy. Then I use splice function to get every 3 elements out of the array splice (@array, 0,3) count "mean" from these elements and print it out. use push function to put the spliced elements back to the end of the array. By using a for loop( looping for 32 times) I get all the means and print all of them out, separated by tab. I get the standard error and standard deviation by using the similar method. I write all the results into a file. I then import the results into excel. This is what I do for reading files one by one. In order to proccess many files in the same time I put all the data files in one directory, use opendir and readdir to get each file name, then follow the method above to proccess all the files at one time. I am not sure if this is the best way but it works for me. At the same time I also want to know if there are any ways/quick ways to let the job done. This is the reason why I ask the list. Thanks all for the input. Li __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>