#!/usr/bin/perl -w use strict; use Data::Dumper; undef $/; my $text = ; my $hash = eval '{' . $text . '}'; print Dumper $hash; __DATA__ key0 => 44, "key1" => "fun. \"yes\" 'fun'", 'key2' => 'yahoo\' "fun"'