Loading...

Anyone with knowled… - QuestionCove
OpenStudy (thomaster):

Anyone with knowledge of perl here?

3 years ago
OpenStudy (thomaster):

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

3 years ago
OpenStudy (thomaster):

my $atomicNumber=<STDIN>;chomp($atomicNumber);

3 years ago
OpenStudy (thomaster):

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?

3 years ago
OpenStudy (thomaster):

@e.mccormick

3 years ago
OpenStudy (thomaster):

Do you know this? @Opcode

3 years ago
OpenStudy (e.mccormick):

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.

3 years ago
OpenStudy (thomaster):

oh wow thanks, first example already does the trick :)

3 years ago
Elsa213 (elsa213):

1st I c a thanks from you thomaster :D

2 years ago
OpenStudy (thomaster):

haha 2 months later this question would have been easy peasy :P been working on much more complex problems since

2 years ago
Elsa213 (elsa213):

pffft i dun believe dat ;p

2 years ago
OpenStudy (e.mccormick):

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.

2 years ago
jaynator495 (jaynator495):

@perl how about you help here? :P

2 years ago
OpenStudy (e.mccormick):

She has perls of wisdom, not perls of code.

2 years ago
jaynator495 (jaynator495):

LOL

2 years ago
Similar Questions: