#!/usr/bin/perl -w


# Filename: ubby-dubby.pl
# For Comp 225, Spring 2002
# Courtesy of Sergey Butkevich
 

$file = 'test.txt';

open (INFO, $file) or die "can not open $file: $!";

$nv = "[^aioueAIOUE]"; 
$nvy = "[^aioueyAIOUEY]";

while (<INFO>) {
  s/($nv|^)([aiou])/$1ubb$2/g;
  s/($nv|^)(e[a-zA-Z])/$1ubb$2/g;
  s/($nvy|^)y/$1ubby/g;
  s/($nv|^)([AIOU])/$1Ubb\l$2/g;
  s/($nv|^)(E[a-zA-Z])/$1Ubb\l$2/g;
  s/($nvy|^)Y/$1Ubby/g;
  print;
}

  
