How to decode JSON in Perl language?

advertisements

How to decode JSON in Perl language?

My try:

 #!/usr/bin/perl
use LWP::Simple;
$web_source = get('https://api.twitter.com/1.1/search/tweets.json');
$decoded_json = decode_json($web_source);
print $decoded_json;

Error:

Undefined subroutine &main::decode_json called at api.pl line 4.

How to correct this?


use JSON;

I hope you know that the URL you are trying to access wants authorization though.