in reply to Trying to build a hash from a string...
Your string looks very much like JSON format. If you add braces around it, you can use the JSON module and are done:
use strict; use warnings; use Data::Dumper; use JSON; my $info = '"word1": 12345, "word2": true, "another_word": true, "some +thing_else": ["Something", "Some 2", "http://www.website.com"], "more +": "5"'; my $hash = from_json '{'.$info.'}'; print Dumper $hash;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Trying to build a hash from a string...
by calebcall (Sexton) on Nov 09, 2013 at 09:33 UTC |