Created
June 19, 2014 16:42
-
-
Save smujohnson/04dd4a68632cee2fbb2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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