Perl calculate average and standard deviation from specified column of a text file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • julia1128
    New Member
    • Mar 2010
    • 2

    #1

    Perl calculate average and standard deviation from specified column of a text file

    Hi all,

    I'm a newbie to perl, really need some help. It seemed to be a very simple question but I kept getting wrong answers... Thanks in advance!!

    The text file looks like this:
    0.000004 56 78
    0.000005 67 89
    0.000006 78 23
    0.000007 12 56

    I need to calculate the average and standard deviation for the 2nd and 3rd column . Thank you so much!!

    I appreciate any suggestions :)
  • julia1128
    New Member
    • Mar 2010
    • 2

    #2
    hmm.. just to clarify. 0.000004 is column 1, 56 is column 2 and 78 is column 3. Thanks!!!!

    Comment

    • toolic
      Recognized Expert New Member
      • Sep 2009
      • 70

      #3
      Use the "avg" and "stddev" functions in the CPAN Acme::Tools module:

      Comment

      Working...