http://www.perlmonks.org?node_id=1039953


in reply to pattern matching in array

Simple one liner for the same.
perl -e 'my @ar = qw( adf "afaf faf ff" af "abf"); $_ =~ m/^\".+$/ && +print "Yes=",$_,"\n" foreach(@ar);'
Output:
Yes="afaf Yes="adf"

Replies are listed 'Best First'.
Re^2: pattern matching in array
by hbm (Hermit) on Jun 20, 2013 at 11:36 UTC

    You don't need to escape the quote, nor gobble up the entire string. Simply: m/^"/

      hey

      now i am trying to work to find words starting with "" in array and I am doing this

       @foo_d = grep(/""/, @arr);

      but it is not working , @foo_d always holds 1