in reply to Store and match

#!/usr/bin/perl use strict; use warnings; while($_=<DATA>){ if (/^\[Note\]\w+,(\w+)/){ my $x =$1; print "$x\n"; } } __DATA__ [Note]note_values,notes_values2 [Book]novels,magazines
A couple of comments: