use strict; use warnings; use feature 'say'; use Reddit::Client; my $subreddit = '/r/perl'; my $limit = 25; my $reddit = Reddit::Client->new(user_agent => 'MyApp/1.0'); my $last_post; foreach my $page (1 .. 8) { my $links = $reddit->fetch_links( subreddit => $subreddit, limit => $limit, after => $last_post ); foreach my $link (@{ $links->{items} }) { say $page, ': ', $link->{title}; } $last_post = $links->{items}->[-1]->{name}; }