in reply to joining string content

A regex substitution can do that, but its readability is not high:
my $str = '+book +dog +cat'; print '"', $str =~ s/ /", "/gr, '"';
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: joining string content
by GrandFather (Saint) on Jun 24, 2025 at 21:26 UTC

    Given OP's code, as an important criteria, readability is not high!

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
Re^2: joining string content
by Anonymous Monk on Jun 24, 2025 at 13:13 UTC