Skip to content

Instantly share code, notes, and snippets.

@smujohnson
Created June 19, 2014 16:42
Show Gist options
  • Save smujohnson/04dd4a68632cee2fbb2a to your computer and use it in GitHub Desktop.
Save smujohnson/04dd4a68632cee2fbb2a to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
# ---
sub repl {
my $in = shift;
if ($in eq 'A') { 'foo' }
elsif ($in eq 'B') { 'bar' }
}
my $x = "FARMBUDDY.PEARL.yomama32";
$x =~ s[A|B][repl($&)]eg;
say $x;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment