in reply to Re: Puzzled about strict
in thread Puzzled about strict

Specifically, the error is:

"Can't use string ("a") as a subroutine ref while "strict refs" in use + at line [eval { $result .= &{$_}(@time); };]"

If you must, you can turn off strict ("no strict 'refs'") immediately before that eval and turn it back on immediately after.

Update: Just another thought, why not store your subroutines in a hash where the format strings are the keys? Something like:

my %method_map = (a => sub { ... }, A => sub { ... } ); my $token = 'a'; # or 'A', 'D', etc. my $result .= $method_map{$token}->(@args);

This is strict compatible and IMO is more maintainable code.