Hello,
I have an array carrying 10 values one of the value is:
$var = "res":{ "url":"http://www.abc.org/", "title":"extracting data using JSON ", "snippet":"valuable information using JSON ", "meta":{"xy_suburl":"/abstract/123.htm","xy_keywords":" JSON","hj_year":"2009" }}
i used the code:
#!/usr/bin/perl --
use strict; use warnings;
use JSON;
Main( @ARGV );
exit( 0 );
sub Main {
my $json = <<'__JSON__';
{"res":{ "url":"http://www.abc.org/", "title":"extracting data using J
+SON ", "snippet":"valuable information using JSON ", "meta":{"xy_subu
+rl":"/abstract/123.htm","xy_keywords":" JSON","hj_year":"2009" }}}
__JSON__
my $perl_scalar = JSON->new->decode($json);
print JSON->new->utf8(1)->pretty(1)->encode($perl_scalar);
print $perl_scalar->{res}{title}, "\n";
}
__END__
But using this i am able to get data of one line, but i need to generalize it. i want data from all the lines i.e from the array @var. How can i do it???