----- Original Message ----
From: Gunnar Hjalmarsson <[EMAIL PROTECTED]>
To: beginners@perl.org
Sent: Saturday, April 5, 2008 11:22:41 PM
Subject: Re: String To Hash Conversion

Prabu Ayyappan wrote:
> I want to convert a string into a Hash data structure 
> 
> For Example
> 
> String: 
> "[['aaa',{27' => '543','21' => '111','Client' => '543','chat' => '111'}]]"
> 
> Hash:
> [['aaa',{27' => '543','21' => '111','Client' => '543','chat' => '111'}]

C:\home>type test.pl
use Data::Dumper;
$string = "['aaa',{'27' => '543','21' => '111',
           'Client' => '543','chat' => '111'}]";
$ref = eval $string;
print Dumper $ref;

C:\home>test.pl
$VAR1 = [
           'aaa',
           {
             '27' => '543',
             '21' => '111',
             'Client' => '543',
             'chat' => '111'
           }
         ];

C:\home>

Thanks a ton that helped me a lot....

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/








      
____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

Reply via email to