Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Keyed list in perl

by siva kumar (Pilgrim)
on Mar 13, 2007 at 11:01 UTC ( [id://604502]=note: print w/replies, xml ) Need Help??


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"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://604502]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-26 00:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found