in reply to Re: Confusion with Unzip and GREP
in thread Confusion with Unzip and GREP

Poppycock!

#!perl use strict; use warnings; use 5.010; use Data::Dumper; my @list = qw[ Xindex r-index.txt Index.txt notIdx.txt ]; my @file = grep( /index/i , @list ); say Dumper( \@file ); __END__ $VAR1 = [ 'Xindex', 'QIndex', 'r-index.txt', 'Index.txt' ];

See Eliy's reply about grep-in-scalar-context.

Replies are listed 'Best First'.
Re^3: Confusion with Unzip and GREP
by Anonymous Monk on Dec 11, 2014 at 10:52 UTC

    Correction: given above @list, output should have been (shortened the list while posting but failed to adjust output along the way) ...

    $VAR1 = [ 'Xindex', 'r-index.txt', 'Index.txt' ];
Re^3: Confusion with Unzip and GREP
by Anonymous Monk on Dec 11, 2014 at 10:58 UTC

    Sorry Eily for I had misspelled your (pseudo)name.

      It's alright, I hadn't even noticed :)