I'm trying to grep a special pattern in an array of strings.
My array of strings is like this :
@list=("First phrase with \"blabla - Word\" and other things "
,"A phrase without... "
,"Second phrase with \"truc - Word\" and etc... "
,"Another phrase without... "
,"Another phrase with \"thing - Word\" and etc... ");
and I tried to grep the pattern "..... - Word" with this function :
@keyw = grep { /\".* Word\"/} (@list);
and I have the following result :
print (Dumper ( @keyw));
$VAR1 = 'First phrase with "blabla - Word" and other things ';
$VAR2 = 'Second phrase with "truc - Word" and etc... ';
$VAR3 = 'Another phrase with "thing - Word" and etc... ';
My grep function is ok to grep the phrase but I would like to grep just the pattern and get the following result :
$VAR1 = '"blabla - Word"';
$VAR2 = '"truc - Word"';
$VAR3 = '"thing - Word"';
Do you know how to reach this result ?