http://paperlined.org/dev/src/pl/reddit/created.pl

#!/usr/bin/perl

# given a URL of a Reddit story or comment, display the creation date/time of that story or comment 
    use strict;
    use warnings;

    use LWP::Simple;
    use JSON::PP;       # became a core module in Perl v5.13.9

    use Data::Dumper;



my $url = shift
        or die "Please specify the URL of a reddit story or comment.\n";


my $is_comment = ($url =~ m#^http://(?:[^/]*/){6}.#s);
#print $is_comment, "\n"; exit;


my $content = get("$url.json");
my $json = decode_json($content);
#dump_json($json); exit;




my $section_data = $json->[$is_comment ? 1 : 0]{data}{children}[0]{data};
#dump_json($section_data); exit;

my $created = $section_data->{created_utc};
my $created_text = scalar(gmtime($created));

my $markdown = $section_data->{$is_comment ? "body" : "selftext"} || '';

my $title = $section_data->{title} || '';

print "This ", ($is_comment ? "comment" : "story"), " was created on $created_text\n"     if ($created);

print "\n\n========[ markdown ]========\n$markdown\n"        if ($markdown);

print "\n\n========[ title ]========\n$title\n"          if ($title);








# display a string to the user, via 'vim -R'    (note: first arg is a .vimrc command, use  empty-string if unneeded)
sub vim {my$pid=open my$vim,"|-",'vim','-R','-c',shift,'-';print$vim @_;close$vim;waitpid$pid,0}

# pretty-print JSON
sub dump_json {vim('set syntax=javascript', JSON::PP->new->pretty->encode(@_))}

Generated by GNU enscript 1.6.4.