in reply to Store and match
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Store and match
by Anonymous Monk on Aug 11, 2009 at 06:37 UTC | |
by prasadbabu (Prior) on Aug 11, 2009 at 07:07 UTC |
In Section
Seekers of Perl Wisdom