Loading ...
Sorry, an error occurred while loading the content.

Re: Usage of regular expression?

Expand Messages
  • Mike Flannigan
    ... I would do: while ( ) { next unless tr/a//; next unless tr/e//; next unless tr/i//; next unless tr/o//; next unless tr/u//; print; } Mike
    Message 1 of 10 , Dec 3, 2004
    • 0 Attachment
      perl-beginner@yahoogroups.com wrote:

      >
      > Date: Thu, 02 Dec 2004 23:53:52 -0000
      > From: "Jeff Shu" <santa98bn@...>
      > Subject: Usage of regular expression?
      >
      > Hello everyone:
      >
      > Hello
      >
      > I am doing a exercise which requires me to find out all the words
      > that contains five vowels(a, e, I, o, u) from a text file.
      >
      > I wrote a the following code to test it.
      > While(<>)
      > {
      > print if /aeiou/
      > }
      >
      > but the result didn't show any words that contains five vowels. I
      > am
      > wondering what's wrong the my regular expression. Please give me
      > some
      > suggestions. Thanks!
      > Jeff
      > 12-02-04

      I would do:

      while (<>) {
      next unless tr/a//;
      next unless tr/e//;
      next unless tr/i//;
      next unless tr/o//;
      next unless tr/u//;
      print;
      }


      Mike
    Your message has been successfully submitted and would be delivered to recipients shortly.