Hello Monks i attempted to start making a file to caluculate the average of 3 different files and print this on to a out put file the input is as follows
1 2
2 3
3 4
4 5
etc (tab column)
This is the same for all 5 files i want to calculate the average of each data point and print into a output file this is what i have so far
#!/usr/bin/perl
use Modern::Perl;
open FILE1, "<", "file1.txt";
open FILE2, "<", "file2.txt";
open FILE3, "<", "file3.txt";
my @file1 = {
chomp;
my ($index, $value) = spilt /\s/;
}
my @file2 = {
chomp;
my ($index, $value) = spilt /\s/;
}
my @file3 = {
chomp;
my ($index, $value) = spilt /\s/;
}
open (OUTFILE, ">average.txt") or die(Output file error");
I don't know if this is even correct and how to proceed if someone could point me in the right direction thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.