in reply to need an array ref from grep
Somehow the \ in this case doesn't do what I need.
Correct. The following:
\( ... )takes a reference of every item in the list, without flattening it first.
See the following as an example:
use Data::Dumper; my $scalar = 'string'; my @array = ( 1,2,3 ); my %hash = ( a => 1, b => 2 ); print Dumper \( $scalar, @array, %hash );
This is also a useful trick for getting a reference to a scalar when your editor's syntax coloring (eg, BBEdit) thinks you're escaping a quote:
my $var = \('string');
|
|---|