in reply to Dispatch table with parameter
#!/usr/bin/env perl use 5.010; use strict; use warnings; my %table = ( uppercase => sub { uc $_[0] }, lowercase => sub { lc $_[0] }, mixedcase => sub { ucfirst lc $_[0] }, ); say $table{"uppercase"}->("Foo"); say $table{"lowercase"}->("Bar"); say $table{"mixedcase"}->("Baz");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dispatch table with parameter
by Saved (Beadle) on Jun 03, 2013 at 16:58 UTC |