#!/usr/bin/perl
use strict;
use warnings;
use JSON;
my $curl_string = `curl -s http://api.twitter.com/1/trends/1.json`;
my $json_result = from_json($curl_string);
foreach my $trend (@{$json_result->[0]->{'trends'}}) {
print $trend->{'name'} . "\n";
}
This script requires that you install the Perl JSON module by Makamaka Hannyaharamitu. This can easily be done either by downloading and compiling it from cpan.org or by running the cpan command line interface and typing "install JSON".
I'm also using the curl binary to execute the request by executing a system call from inside Perl. You can also use the perl bindings for libcurl to execute the request.