Feed on

i’m still new to perl, but it appears that the language lacks a built-in switch capability. and, i’ve had bad luck with getting the bundled switch module working. after some poking around online, i’ve finally gotten something resembling a switch statement working:

# pull down input
$choice = ;

for ($choice) {
/i/ && do { get_gene_info(); };
/s/ && do { get_gene_seq(); };
/n/ && do { get_gene_name(); };
/a/ && do { get_gene_name(); };
/q/ && do { print “\nadios amigos!\n”; exit; };

(this is being employed to query a database of genetic microarray data. also, apologies for being unable to reference where i found this method; i forgot to make a note of it in my code.)

Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

Did I get this wrong? Let me know!

Trackback URI | Comments RSS