Syntax::Feature::Qn - Perl syntax extension for line-based quoting
use qn; @foo = qn { line one line two line three }; # ("line one", "line two", "line three") $bar = 'BAR'; @foo = qqn { foo $bar bam }; # ("foo", "BAR", "bam")
This module adds line-based quoting operators to Perl, similar to here-docs, but without the required outdenting.
The qn() and qqn() operators are drop-in replacements for q() and qq(), respectively. The same delimiter rules apply.
The quote body is split on "\n" and each resulting list item is stripped of leading and trailing whitespace. Inner whitespace is preserved.
Empty lines, or lines consisting of only whitespace, translate to empty string list items.
The first and last items can be on the same line as the delimiter, or not. So, these are the same:
@foo = qn { first second third fourth }; # ("first", "second", "third", "fourth") @foo = qn { first second third fourth }; # ("first", "second", "third", "fourth")
You could even get away with this:
@foo = qn { first }; # ("first")
q, qq in perlfunc.
Rick Myers, <jrm@cpan.org>
Copyright (C) 2017 by Rick Myers.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.1 or, at your option, any later version of Perl 5 you may have available.
To install Syntax::Feature::Qn, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Syntax::Feature::Qn
CPAN shell
perl -MCPAN -e shell install Syntax::Feature::Qn
For more information on module installation, please visit the detailed CPAN module installation guide.