my $time_zone_func = $file =~ /^London/ ? \&CORE::gmtime : \&CORE::localtime; strftime($date_format, $time_zone_func->(time)) #### my $time_zone_func = $file =~ /^London/ ? sub { gmtime($_[0]) } : sub { localtime($_[0]) }; strftime($date_format, $time_zone_func->(time)) #### my $time_zone_func = sub { $file =~ /^London/ ? gmtime($_[0]) : localtime($_[0]) }; strftime($date_format, $time_zone_func->(time))