I have one text file . I having a problem to read multiple lines in text file
my Text file
Code I am using ::
[CODE=perl]
my @AOH;
open F,"<$Data" or die $!;
while(<F>){
push @AOH, {} if /^A/;
$AOH[-1]{$1}=$2 if /\s*(\w*)\s*=\s* (.*)\s*/;
}
close F;
print Dumper \@AOH;
[/CODE]
Output I am getting
[CODE=perl]
$VAR1 = [
{
'A20' => '{ { 11, 32, 96, 33, 28 },
',
'A25' => '100'
}
];
[/CODE]
Question
How I can fix "A20" ? Because A20 has 3 string but it is displaying only one
my Text file
Code:
A
{
A20 = { { 11, 32, 96, 33, 28 },
{ 22, 23, 45, 23, 22 },
{ 36, 25, 46, 36, 78 }}
A25= 100
}
[CODE=perl]
my @AOH;
open F,"<$Data" or die $!;
while(<F>){
push @AOH, {} if /^A/;
$AOH[-1]{$1}=$2 if /\s*(\w*)\s*=\s* (.*)\s*/;
}
close F;
print Dumper \@AOH;
[/CODE]
Output I am getting
[CODE=perl]
$VAR1 = [
{
'A20' => '{ { 11, 32, 96, 33, 28 },
',
'A25' => '100'
}
];
[/CODE]
Question
How I can fix "A20" ? Because A20 has 3 string but it is displaying only one
Comment