Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A perl script which outputs the usernames for new comments on Hacker News, preceded by the date.
#!/usr/bin/perl
my $url = "https://news.ycombinator.com/newcomments";
sub html {
`curl get $url 2>/dev/null`;
}
printf "# %s", `date`;
my @usernames;
for my $line (html()) {
my @usernames = ($line =~ m/href="user\?id=([^"]*)"/g);
# print $line;
for $username (@usernames) {
printf "%s\n", $username;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.