polycomb has asked for the wisdom of the Perl Monks concerning the following question:
Hi, all:
I have a simple work task: input from keyboard a name with two values(its concentration and volume) and then print out a table that shows list of names with their concentration, volume, total yield(con*vol), how much for 30ug/50ug(30/concentration).
I don't know how to create a hash with two values from STDIN, and here is the one I put those in the program.
Many thanks.#!/user/bin/perl # RNAi_cal.plx use warnings; #use strict; my $yield; my $thirty_ug; my $fifty_ug; #my %RNA; #print "Please enter RNAi name, concentration:\n"; my %RNA=( Ash2 =>"1.85", Ja2_1 =>"1.89", Ja2_2 =>"2.49", Set1_1 =>"1.55", Set1_2 =>"2.88"); my %vol=( Ash2 =>"150", Ja2_1 =>"150", Ja2_2 =>"100", Set1_1 =>"150", Set1_2 =>"100"); print "\t Con\.\t Volume\t Total yield (ug)\t 30ug\t 50ug\t \n"; for (keys %RNA){ $yield=$RNA{$_}*$vol{$_}; $thirty_ug=int(30/$RNA{$_}*100)/100; $fifty_ug=int(50/$RNA{$_}*100)/100; print "$_\t $RNA{$_}\t$vol{$_}\t $yield\t \t\t$thirty_ug\t $fifty_ +ug\t \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: a simple work task
by SuicideJunkie (Vicar) on Jan 14, 2011 at 18:34 UTC | |
|
Re: a simple work task
by johngg (Canon) on Jan 14, 2011 at 20:17 UTC | |
by planetscape (Chancellor) on Jan 15, 2011 at 08:25 UTC | |
|
Re: a simple work task
by Anonymous Monk on Jan 14, 2011 at 18:37 UTC | |
by polycomb (Initiate) on Jan 14, 2011 at 20:11 UTC | |
by polycomb (Initiate) on Jan 14, 2011 at 19:37 UTC | |
by toolic (Bishop) on Jan 14, 2011 at 19:42 UTC | |
by Anonyrnous Monk (Hermit) on Jan 14, 2011 at 19:51 UTC |