#!/usr/bin/perl
use strict; use warnings;
local $" = '';
my $x = qq|@{[ map "[$_]", qw(a b c d e) ]}|;
Вы также можете немного обобщить:
#!/usr/bin/perl
use strict; use warnings;
my @array = 'a' .. 'e';
print decorate_join(make_decorator('[', ']'), \@array), "\n";
sub decorate_join {
my ($decorator, $array) = @_;
return join '' => map $decorator->($_), @$array;
}
sub make_decorator {
my ($left, $right) = @_;
return sub { sprintf "%s%s%s", $left, $_[0], $right };
}