473,666 Members | 2,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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 :)
Mar 29 '10 #1
2 5274
julia1128
2 New Member
hmm.. just to clarify. 0.000004 is column 1, 56 is column 2 and 78 is column 3. Thanks!!!!
Mar 29 '10 #2
toolic
70 Recognized Expert New Member
Use the "avg" and "stddev" functions in the CPAN Acme::Tools module:

http://search.cpan.org/~kjetil/Acme-Tools/Tools.pm
Mar 30 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
3183
by: Ilias Lazaridis | last post by:
within a python script, I like to create a collection which I fill with values from an external text-file (user editable). How is this accomplished the easiest way (if possible without the need of libraries which are not part of the standard distribution)? something like: text-file: {peter, 16},
5
11928
by: francescomoi | last post by:
Hi. Using PHP 4.3.11, I want my script not to write standard output on the webpage, but on a textfile. I tried with: $variableName = 44;
3
1740
by: Limeburner72 | last post by:
Hi, I'm trying to write a program which reads from a text file but the output is always:Couldn't open a file.The path of file is C:\Perl\perlscripts.Where should I place this text file ?
2
5130
by: Quentin | last post by:
How would I calculate standard deviation of a csv file? Any code examples would be great! Thank you!
2
1239
by: am2007 | last post by:
Hi All, I'm new to perl and would appreciate if you could please help me with this: Perl code which examines lines in a text file, and if the line contains a GenBank ACCESSION, prints out that GenBank ACCESSION. If you do not know what a GenBank ACCESSION is, you may use “street address” as a substitute. Thanks much.
6
5857
by: kumarboston | last post by:
Hi All, I am trying to get an average value for my data, here is my data file DATA FILE EP1934.PDB 250 250 11.27 EP1934.PDB 251 251 12.7332 EP1934.PDB 252 252 6.38341 EP1934.PDB 253 253 8.04318 EP1934.PDB 254 254 13.7123
6
3482
by: shibujohn82 | last post by:
Hi, My data set is followed like this... (as tab delimited input.csv) First is column is gene name, second column is bn count, third colums is sh count. ENSRNOG00000000417 42 102 ENSRNOG00000000417 26 52 ENSRNOG00000000417 152 284 ENSRNOG00000000417 270 372 ENSRNOG00000000417 418 540
2
1854
by: Kalpesh Katwala | last post by:
I'm trying to read in a data file into an array. And split it into lines. I've a for loop which will parse the array, split the line (on ",") and execute another command. Here is the code. Problem is that PERL will parse only the last 11 lines from the data file. open TestList, "Testlist.dat" or die "Cannot open file to read data\n"; @array = <TestList>; close TestList; print (@array); <<< This prints the complete data file -...
1
1532
by: Greenwood | last post by:
Im writting a program which read a file choosen by the user, it is a txt. file with some numbers in it like : 98.09809 09.9879 95.35445 after the file has been read, I do some mathematical calculation, the one Im doing here is the standard deviation of all the data in the file. But my problem is that I return the result of the function and try to output it to a textbox, nothing worked my textbox is empty. Please advise. here is my code! ...
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8355
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8638
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7381
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6191
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.