
paragkalra
Novice

Mar 19, 2009, 2:43 PM
Post #1 of 2
(1292 views)
|
|
Finding vowels
|
Can't Post
|
|
I want to find words containing at least 3 vowels. This is what I am trying: #!/usr/bin/perl @myarray=qw/......it contain words..../; @vowels=qw/a e i o u/; foreach(@myarray) { $var=$_; for ( $p=0; $p<5 ; $p++ ) { for ( $q=0; $q<5 ; $q++ ) { for ( $r=0; $r<5 ; $r++ ) { if ( $var =~ /^(.*)($vowels[$p])(.*)$vowels[$q](.*)$vowels[$r](.*)$/ ) { push @words_having_3_vowels, $var; } } } } } print "@words_having_3_vowels \n"; But not getting the expected results. Parag.A.Kalra, The Linux Man http://www.paragkalra.com/ In this world without WALLS and GATES who need WINDOWS! USE LINUX! STOP PIRACY! GO OPEN SOURCE!
|