in reply to Removing spaces from query results

If your keys don't have leading or trailing whitespace, you could filter your results like this:

$ perl -Mstrict -Mwarnings -E ' my $values = [ { name => " qwe ", last => " rty" }, { name => "asd ", last => " fgh " }, { name => " zxc", last => "vbn " }, ]; say "Raw:"; say "@{[%$_]}" for @$values; say "Filtered:"; say "@{[%$_]}" for map { { map { /^\s*(.*?)\s*$/; $1 } %$_ } } @$v +alues; ' Raw: last rty name qwe last fgh name asd last vbn name zxc Filtered: name qwe last rty name asd last fgh name zxc last vbn

Update: Originally, the last line of the code above was:

say "@{[%$_]}" for map { { map { /^\s*(.*?)\s*$/; $1 } @{[%$_]} } } @$ +values;

I wanted the @{[%$_]} construct in the double-quoted string to format the output. I repeated this construct in the map but it's unnecessary: just %$_ (as it is now) is fine.

-- Ken