Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Non Greedy?

by citromatik (Curate)
on Jun 02, 2009 at 23:54 UTC ( #767823=note: print w/ replies, xml ) Need Help??


in reply to Non Greedy?

Some gave you hints to solve your regexp problem. I will give you a quick-n-dirty non-regexp related solution (I will never put a code like this in production):

use strict; use warnings; use Data::Dumper; my $i = "[[{bunches_of_data}, {more_data}, {etc}], [{hey_more_data}, { +etc}, {etc}], [{etc}, {etc}, {etc}]]"; $i =~ s/{|}//g; $i =~ s/([^\[\],\s]+)/'$1'/g; my $iv = eval "$i"; print Dumper $iv;

Outputs:

$VAR1 = [ [ 'bunches_of_data', 'more_data', 'etc' ], [ 'hey_more_data', 'etc', 'etc' ], [ 'etc', 'etc', 'etc' ] ];

citromatik


Comment on Re: Non Greedy?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-12-29 05:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (184 votes), past polls