Skip to content

Instantly share code, notes, and snippets.

@andrewsolomon
Created May 21, 2017 18:06
Show Gist options
  • Save andrewsolomon/23eb06e065e9c3d2f0bd53ca6c62fc07 to your computer and use it in GitHub Desktop.
Save andrewsolomon/23eb06e065e9c3d2f0bd53ca6c62fc07 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dump 'pp';
use feature 'say';
sub translate {
my ($rh_dict, $ra_words) = @_;
my @trans = map { exists($rh_dict->{$_}) ? $rh_dict->{$_} : $_ } @$ra_words;
return \@trans;
}
my $ra_en_de_xlat = translate({
ich => 'I',
bin => 'am',
ein => 'a',
}, [@ARGV]);
say join(' ',@$ra_en_de_xlat);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment