- my $img = "flag/$ref.png";
- $_ = sprintf '<img src="/%s" alt="%s">', $img, $ref if -e $img;
+ sub showflag {
+ my ($cc) = @_;
+ my $img = "data/flag/$cc.png";
+ return -e $img &&
+ sprintf '<img src="/%s" alt="%s">', $img, $cc;
+ }
+
+ $cell = showflag($code) // join(' ',
+ map { showflag($_) || $_ } split / /, $ref
+ );