in reply to Regular Expression

chomp() shouldn't really remove the whole word, even a weird setting of $/ wouldn't make that happen.

You can try to use chop(), which trims ONLY the last character no matter what it is but, really, a look at the code would be a better choice: it's probably not chomp that eats your words. ;-) Michele.

Replies are listed 'Best First'.
Re: Re: Regular Expression
by optikool (Novice) on May 19, 2003 at 07:08 UTC
    Thanks a lot for everybodies input. I'm not sure why the chomp function was not working correctly but it is working correctly now which solved most of the other problems I was having. I have one more question... Is there a way to match words with double letters.. ex keenness or mississippi? Also is there a way to match words that are in alphabetical order.. ex abby or abit? Thanks so much for your help. =0)
      For double letters:
      if ($word =~ /(.)\1/) ...
      All letters in alphabetical order (not regex):
      if (lc($word) eq join "", sort split //, lc($word));

      antirice    
      The first rule of Perl club is - use Perl
      The
      ith rule of Perl club is - follow rule i - 1 for i > 1