Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: vowel_search

by CheeseLord (Deacon)
on Aug 17, 2001 at 04:09 UTC ( #105576=note: print w/replies, xml ) Need Help??


in reply to vowel_search

Your code at present will disregard a matching string on the first line. In addition, you read in the entire file at once, sucking up a good deal of memory if the file is quite large. Here's another way of doing it:

#!/usr/bin/perl -w use strict; # Or don't. See if I care. while (<>) { print if (/[Aa]/ && /[Ee]/ && /[Ii]/ && /[Oo]/ && /[Uu]/); }

I only used the character classes there because (I hear) they're faster than /i matches. Could be wrong on that count, though.

His Royal Cheeziness

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://105576]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2021-12-08 04:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (34 votes). Check out past polls.

    Notices?