aeiou - outputs all words who contain the vowels (a e i o...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 #!/opt/bin/perl -w ## homework #3 ## aeiou ## print words that contain all the lowercase vowels a e i o u (in order) ## date: 10/03/2006 ## use strict #@ARGV = qw(/usr/dict/words) ##-------------------------------------------------------------- ## main program ##-------------------------------------------------------------- main() exit(0) ##-------------------------------------------------------------- ## subroutines ##-------------------------------------------------------------- sub main { while (<>) { #regular expression - give all words with a e i o u in order print if /a.*?e.*?i.*?o.*?u/ } } __END__ #NAME? Err:509 aeiou - finds words that have 'a', 'e', 'i', 'o', 'u' in order Err:509 ./aeiou somefile ./aeiou /usr/dict/words ./aeiou < somefile some_process | ./aeiou Err:509 This program reads the file specified in the command line arguments and
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: outputs all words who contain the vowels (a e i o u) in order. This program uses a regular expression to pettern match. Sheet1 Page 2 if /a.*?e.*?i.*?o.*?u/ which translates to find all words with 0 or more characters then an "a" followed by with 0 or more characters then an "e" followed by with 0 or more characters then an "i" followed by with 0 or more characters then an "o" followed by with 0 or more characters then an "u" followed by with 0 or more characters use /i to turn off case sensitive search The content of the search is read from a file specified on command line arguments. The content of the response is printed on stdout. Error messages are printed on stderr. #NAME? Err:509 #NAME?...
View Full Document

This document was uploaded on 08/21/2009.

Page1 / 2

aeiou - outputs all words who contain the vowels (a e i o...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online