in reply to Keyed list in perl

If you want to do this with regex, you can use the following code.
$line = "{chart {{1 {{title title_1} {xlable X-lab} {ylable Y-lab} {de +scription desc1} {type line} {series {{1 {{x_data {1 2 3 4 5}} {y_dat +a {20 90 60 50 30}}}}}}}}}}"; $line =~ /x_data\s+\{(.*?)\}/; print "X DATA : $1 \n"; $line =~ /y_data\s+\{(.*?)\}/; print "Y DATA : $1 \n";
UPDATE: Enclose the matching expression within if block.
if ($line =~ /x_data\s+\{(.*?)\}/) { print "X DATA : $1 \n"; } if ($line =~ /y_data\s+\{(.*?)\}/) { print "Y DATA : $1 \n"; }