in reply to Quickly changing a function under test in Test::More

Hi try this,

#!/usr/local/bin/perl use strict; use warnings; use Data::Dumper; my %commands = ( 'command1' => { 'description' => "Does something", 'function' => sub { my $var = shift; return "var = $var\n" } } ); my $cmd = 'command1'; print $commands{$cmd}{'function'}->("hello");

It's reference part, to learn more about reference, go through perlref link, above given by duff.