Anyone with knowledge of perl here?
Oke so I'm new to perl, need it for my bioinformatics minor. Just playing around a little and I stumbled upon something that's probably very easy, but I can't get it to work. I have a hash: my %symbol=( "1"=>"H", "2"=>"He", "3"=>"Li", "4"=>"Be", "5"=>"B", "6"=>"C", "7"=>"N", "8"=>"O", "9"=>"F", "10"=>"Ne", "11"=>"Na", "12"=>"Mg", "13"=>"Al", "14"=>"Si", "15"=>"P", "16"=>"S", "17"=>"Cl", "18"=>"Ar", "19"=>"K", "20"=>"Ca", ); the first number is an atomic number, the value is the corresponding atom abbreviation. atomic number 1 is hydrogen which is H what I need is to enter a value, and the program should return the element symbol so if I enter 15, it should return P No idea how to do this xD
my $atomicNumber=<STDIN>;chomp($atomicNumber);
Another way is to put it in an array instead of a hash, can I return the nth value in an array? That way I only have to put them in order in a 1-dimensional table. The 18th value in the array would be Ar. How to I get the 18th value?
@e.mccormick
Do you know this? @Opcode
I only learned enough Perl to modify some scripts other made. But I googled up perl data types and found this: http://www.oreillynet.com/pub/a/perl/excerpts/9780596000271/data-structures.html It looks like you have some good options there.
oh wow thanks, first example already does the trick :)
1st I c a thanks from you thomaster :D
haha 2 months later this question would have been easy peasy :P been working on much more complex problems since
pffft i dun believe dat ;p
All it takes is familiarity with the specifics of a language and knowledge of programming theory. After 2 months, I bet his familiarity is a lot better.
@perl how about you help here? :P
She has perls of wisdom, not perls of code.
LOL
Join our real-time social learning platform and learn together with your friends!