Take the 2-minute tour ×  I have a .sql file from which I am
reading my input. Suppose the file contains the following
input....  Message Fruits
Fruit="Apple",Color="Red",Taste="Sweet";  Message Flowers
Flower="Rose",Color="Red";  Now I have written a perl script to
generate hash from this file..  use strict; use Data::Dumper;
my @stack;     my %hash;     push @stack,\%hash;     my @file =
<MYFILE>;     foreach my $row(@file){         if($row =~
/Message /){             my %my_hash;             my @words =
split(" ",$row);             my @sep_words =
split(",",$words[2]);              foreach my $x(@sep_words){
my($key,$value) = split("=",$x);                 $my_hash{$key}
= $value;             push @stack,$stack[$#stack]->{$words[1]} =
{%my_hash};             pop @stack;     print Dumper(\%hash);  I
am getting the following output..  $VAR1 = {           'Flowers'
=> {                          'Flower' => '"Rose"',
'Color' => '"Red";'           'Fruits' => {