EDITED to add: this has been solved. Thanks so much.

I'm a perl novice who wants to learn just enough perl to get by without putting much effort into it.

Please tell me how to read the JSON object returned by

http://web.archive.org/cdx/search/cdx?url=archive.org&output=json&limi +t=3
obtained from
https://github.com/internetarchive/wayback/tree/master/wayback-cdx-ser +ver#output-format-json

CLARIFICATION ADDED: Below is an example json object. I want to assign a variable $first_timestamp to the first timestamp (19970126045828).

[["urlkey","timestamp","original","mimetype","statuscode","digest","le +ngth"], ["org,archive)/", "19970126045828", "http://www.archive.org:80/", "te +xt/html", "200", "Q4YULN754FHV2U6Q5JUT6Q2P57WEWNNY", "1415"], ["org,archive)/", "19971011050034", "http://www.archive.org:80/", "te +xt/html", "200", "XAHDNHZ5P3GSSSNJ3DMEOJF7BMCCPZR3", "1402"], ["org,archive)/", "19971211122953", "http://www.archive.org:80/", "te +xt/html", "200", "XAHDNHZ5P3GSSSNJ3DMEOJF7BMCCPZR3", "1405"]]

How do I do that?

Context:

I currently have the following working code:

use strict; use warnings; use Mojo::UserAgent; use LWP::UserAgent; use HTTP::Request::Common qw(GET); my $outputFilename = "test_output.txt"; my $fh_data; my $name; open( $fh_data, '>', $outputFilename ) or die "Could not open file '$outputFilename' $!"; my $url = "https://public-api.wordpress.com/rest/v1/read/feed/?url=anautismobser +ver.wordpress.com"; my $ua = Mojo::UserAgent->new; my $json = $ua->get($url)->res->json; for my $feedurl ( @{ $json->{feeds} } ) { if ( $feedurl->{meta}{links}{site} ) { my $siteurl2 = $feedurl->{meta}{links}{site}; my $ua2 = Mojo::UserAgent->new; my $json3 = $ua2->get($siteurl2)->res->json; $name = $json3->{name}; print $fh_data "$name"; } } close $fh_data;

I want to modify the code to read the JSON object returned if I set

my $url = http://web.archive.org/cdx/search/cdx?url=archive.org&output +=json&limit=3

and I want to write the timestamps into a text file.

Thank you.


In reply to reading a JSON object by anautismobserver

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.