write a switch statement in perl
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 = <>;
chomp($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.)
0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home