I often need to put quoted word lists (qw/ one two three /
) in array refs,
and plenty of other people do too.
It almost always looks messy —
it would be neat if we had syntax for that.
A DWIM'ish solution would be qw[ one two three ]
, but that boat has sailed.
Right now you have to write:
tuple => [qw( red blue green )]
It would look cleaner to write:
tuple => qw[ red blue green ]
But notation is already taken, as is
tuple => q[ red blue green ]
You might know that you can write:
\qw( one two three )
But that returns a list of scalar refs, not an array ref.
So what about qa
, for quoted array ref?
tuple => qa[ red blue green ]
As with the other quote operators, you could use any delimiter, but square bracket would be the obvious one to use.
comments powered by Disqus