in reply to fall through switch/case in perl
I don't think i have seen this one yet, although it is close in spirit to demerphq's solution:
use strict; no warnings; my @array = reverse 'a' .. 'j'; my $var = shift() - 1; print join '', reverse @array[0..$var];
Update: one-liner for the heck of it
perl -le"@_=reverse a..j;print join'',reverse@_[0..shift()-1]" 5
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: fall through switch/case in perl
by Pragma (Scribe) on Sep 07, 2004 at 19:59 UTC |