Skip to content

Instantly share code, notes, and snippets.

Last active December 16, 2015 15:29
What would you like to do?
generate spam comment from
#!/usr/bin/env perl
use strict;
use LWP::Simple;
sub pick { $_[rand @_] }
my $text = get "";
my @samples = split /\|\n/, $text;
my $template = pick @samples;
$template =~ s/\{(.*?)\}/pick split('\|', $1)/egs;
print $template, "\n"
Copy link

minor nitpick: /r was added in 5.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment