Sha256: 967436b45fde2d77e518046f54e2d38cc81e771af4f32f68157487c3604e4057
Contents?: true
Size: 712 Bytes
Versions: 49
Compression:
Stored size: 712 Bytes
Contents
package PigLatin; use v5.10.1; use strict; use warnings; no if $] >= 5.018, warnings => 'experimental'; sub translate { my $original = shift; my @pig_latin; foreach my $orig ( split /\s+/ => $original ) { given ($orig) { when (/^[aeiou]/) { push @pig_latin => "${original}ay" } when (/^y[^aeiou]/) { push @pig_latin => "${original}ay" } when (/^x[^aeiou]/) { push @pig_latin => "${original}ay" } when (/^([^aeiou]*qu)(.+)/) { push @pig_latin => "$2$1" . "ay" } when (/^([^aeiou]+)(.+)/) { push @pig_latin => "$2$1" . "ay" } } } return join " " => @pig_latin; } __PACKAGE__;
Version data entries
49 entries across 49 versions & 1 rubygems