Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
How can i make construction like this in perl ? Warning - there are no break statements (this technique known as fall through). For example if var = 10, "abcdefghij" will be printed and if var = 5, "fghij" will be printed and so on. Thank you very much for help ! switch (var) { case 10: printf("a"); case 9: printf("b"); case 8: printf("c"); case 7: printf("d"); case 6: printf("e"); case 5: printf("f"); case 4: printf("g"); case 3: printf("h"); case 2: printf("i"); case 1: printf("j"); } In reply to fall through switch/case in perl by ykar
|
|