Skip to content

Instantly share code, notes, and snippets.

@miyagawa
Last active December 16, 2015 15:29
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miyagawa/5455942 to your computer and use it in GitHub Desktop.
Save miyagawa/5455942 to your computer and use it in GitHub Desktop.
generate spam comment from https://gist.github.com/shanselman/5422230
#!/usr/bin/env perl
use strict;
use LWP::Simple;
sub pick { $_[rand @_] }
my $text = get "https://gist.github.com/shanselman/5422230/raw/9863d88bde2f9dcf6b2e7a284dd4a428afdc8c8b/gistfile1.txt";
my @samples = split /\|\n/, $text;
my $template = pick @samples;
$template =~ s/\{(.*?)\}/pick split('\|', $1)/egs;
print $template, "\n"
@eldridge
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