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.

#!/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"; }
Many thanks.

In reply to a simple work task by polycomb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.