Hello Monks, looking for some Perl enlightenment, i'm creating a script that reads the file lines into an array and then searches and print the words that have 2 consecutive vowels in them. This is what I have so far:
#!/usr/local/bin/perl use strict; use warnings; use 5.10.0; my $file = "faketext.txt"; open (FH, "< $file") or die "Can't open $file $!"; my @lines; while (<FH>) { push @lines, $_; foreach $file(@lines) if(($file =~ /a/) && ($file =~ /e/) && ($file =~ /i/) && ($file =~ + /o/) && ($file =~ /u/)) { print $file; }
Though it is giving me an error and not printing the words with the consecutive vowels. Guidance please?!
Update:
Hello Monks, looking for some Perl enlightenment, i'm creating a script that reads the file lines into an array and then searches and print the words that have 2 consecutive vowels in them. This is what I have so far:
#!/usr/local/bin/perl use strict; use warnings; use 5.10.0; my $file = "faketext.txt"; open (FH, "< $file") or die "Can't open $file $!"; my @lines; while (<FH>) { push @lines, $_; foreach $file(@lines); if ($file = ~ /[aeiou]{2}/) { print $file; } }
syntax error at vowels.pl line 11, near ");" execution of vowels.pl aborted due to compilation errors
In reply to Vowel search by Noob@Perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |