#!/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");
In reply to Re: Dispatch table with parameter
by tobyink
in thread Dispatch table with parameter
by Saved
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |