ykar has asked for the wisdom of the Perl Monks concerning the following question:
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"); }
Back to
Seekers of Perl Wisdom