The mistake you have done is you have not stored the current line in variable $x. Also \w+ will match only 'note_values' and not the remaining string 'note_values,notes_values2
' as it contains ',' in between.
The below code will meet your requirement. Also refer perlre to learn how to store the matched value in variables.
while($x=<DATA>){ if ($x =~ /^\[Note\](.+)$/){ $var = $1; #store in a variable print $var; } }
Prasad
In reply to Re: Store and match
by prasadbabu
in thread Store and match
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |