develooper Front page | perl.perl5.porters | Postings from March 2016

Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"

Thread Previous | Thread Next
Lukas Mai
March 2, 2016 08:03
Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Message ID:
Am 02.03.2016 um 05:32 schrieb Linda Walsh (via RT):
> Every once in a while, I start filling an array using
> "qw()", when I run into, not too infrequently, a desire
> to have a var or expression as a "word".  Paths can be
> a good example:
> my short_paths=[ qw( sysfs	sys_classes		netclass						sysmods) ];
> my spth_vals	=[qqw( /sys		$sysfs/class	$sys_classes/net 	$sysfs/module ) ];

It's not core perl, but Quote::Code (available for perl 5.14+) lets you 
write this:

use Quote::Code;
my $pth_vals = [qcw(
   /sys {$sysfs}/class {$sys_classes}/net {$sysfs}/module

Lukas Mai <>

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About