How to parse a text file having data in particular format and store it in hash using perl -


i have text file having data in following format

%app_lookup_strings = (                       common => {                                   password => "password: ",                                   select_action => "select action => ",                                   mgt_close => "bsa_mgtclose",                                 }, 

i have read data text file , store in hash. need know how parse text file having such kind of data , store in similar fashion of hash shown above.

if text file contains 1 hash, straightforward solution is:

#!/usr/bin/env perl use strict; use warnings; use data::dumper;  %hash = 'text.file';  print dumper \%hash; 

output:

$var1 = {           'common' => {                         'mgt_close' => 'bsa_mgtclose',                         'password' => 'password: ',                         'select_action' => 'select action => '                       }         }; 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -