- map { sprintf
- '<svg width="20" height="20" viewBox="0 0 8 6">'
- . '<path d="M1%s"/></svg>',
- join ' m2',
- map { sprintf ',%dv%dm0,-%d',
- ($_ & 1 ? 0 : 2), 2 + ($_ & 2) + ($_ & 1) * 2,
- ($_ & 1 ? 0 : 2) + 2 + ($_ & 2) + ($_ & 1) * 2,
- }
- split //
+ map {
+ my $len = length $_;
+ !$len ? '' : sprintf(
+ '<svg width="%d" height="20" viewBox="0 0 %d 6">'
+ . '<path d="M1%s"/></svg>',
+ $len * 5, $len * 2,
+ join ' m2',
+ map { sprintf ',%dv%dm0,-%d',
+ ($_ & 1 ? 0 : 2), 2 + ($_ & 2) + ($_ & 1) * 2,
+ ($_ & 1 ? 0 : 2) + 2 + ($_ & 2) + ($_ & 1) * 2,
+ }
+ split //
+ );