Angharad has asked for the wisdom of the Perl Monks concerning the following question:
etc ...0 48.23 17.90 48.23 0 49.58 17.90 49.58 0 59.62 52.04 65.80 62.20 56.02 68.82 35.37 37.87 36.52 27.33 50.73 31.85
My problem is I'm not quite sure how to go from here in order to extract one value at a time from each row so I can add all values together when calculating my average.#!/usr/bin/perl use strict; my @line; # shall we get the file then? my $inputfile = $ARGV[0]; # guess we need to open it too open(INPUT, "$inputfile") || die "Error: Can't open $inputfile for reading: $!\n"; # lets place contents of file into array my @filecontents = <INPUT>; # we now want a for loop to access the array for(my $i = 0; $i < @filecontents; $i++) { # place each line in file # into another array @line = split(/\,/, $filecontents[$i]); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: extracting and using values from a matrix file
by friedo (Prior) on Aug 31, 2006 at 16:36 UTC | |
|
Re: extracting and using values from a matrix file
by shmem (Chancellor) on Aug 31, 2006 at 20:18 UTC | |
|
Re: extracting and using values from a matrix file
by graff (Chancellor) on Sep 01, 2006 at 05:33 UTC | |
|
Re: extracting and using values from a matrix file
by dokkeldepper (Friar) on Sep 01, 2006 at 10:57 UTC |