in reply to Store and match
As prasadbabu given correct answer I believe.
As of my understand you want the last potion from the line which begins with Note. I also done this with split function.
use strict; use warnings; my $x; while($x=<DATA>){ chomp($x); if ($x =~ /^\[Note\]/){ my $find=(split(/\,/,$x))[-1] ; print "$find\n"; + + } } __DATA__ [Note]note_values,notes_values2 [Book]novels,magazines [Note]note_values,notes_values56
|
|---|