#!/bin/perl use strict; use warnings; use diagnostics; use Term::ANSIColor; use JSON; use Data::Dumper; open(my $fh, '<', '/home/david/dev/linux.json'); my $json_text = <$fh>; my $test_scalar = decode_json($json_text); my $max = 10; my $count = 0; my $quit = 0; sub reddit { while ($count <= $max) { print colored ['red'], "-> $test_scalar->{data}{children}[$count]{data}{title}\n"; print colored ['yellow'], "$test_scalar->{data}{children}[$count]{data}{url}\n"; $count++; } } reddit(); my $wait = ; chomp($wait); if ($wait eq '\cR') { reddit(); }