in reply to Perl 5.10: switch statement demo
#!/usr/bin/perl use 5.010; use strict; use warnings; for (1 .. 105) { my $what = ''; given ($_) { when (not $_ % 3) { $what .= ' fizz'; continue } when (not $_ % 5) { $what .= ' buzz'; continue } when (not $_ % 7) { $what .= ' sausage' } } say "$_$what"; }
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl 5.10: switch statement demo
by ikegami (Patriarch) on Dec 19, 2007 at 22:32 UTC | |
by talexb (Chancellor) on Dec 20, 2007 at 16:26 UTC | |
by ikegami (Patriarch) on Dec 20, 2007 at 21:27 UTC | |
by talexb (Chancellor) on Dec 20, 2007 at 21:30 UTC |