I wrote a simple script that allows the user to enter a pattern of letters, searches through a list of words in a file, and outputs any words that match the pattern (sort of like a crossword solver). Here's the code:
#!/usr/bin/perl use strict; print "Enter word to be solved.\n"; print "Use a dash (-) to indicate a single missing letter.\n"; print "Use a star (*) to match 0 or more letters.\n"; print "Use a plus (+) to match 1 or more letters.\n"; print " WORD --> "; chomp( my $word = <STDIN> ); $word =~ s/\-/\\w/g; $word =~ s/\*/\\w*/g; $word =~ s/\+/\\w+/g; open WORDLIST, "< WORD.LST" || die "Cannot open WORD.LST: $!\n"; while (<WORDLIST>) { chomp( my $newWord = $_ ); if ( $newWord =~ m/^$word$/i ) { print $newWord . "\n"; } } close WORDLIST;
When I run the script on Windows (ActiveState Perl), it seems to work perfectly. However, when I run it under Cygwin I get no results, no matter what pattern I enter - even if I type the exact word.
My concern isn't as frivolous as it seems. I'm developing a much larger script for work that uses a good bit of RegEx pattern matching. It will eventually run on a Unix server, but I'm running it through Cygwin for alpha testing. I need to be sure I'm getting accurate results before I muck up the data on our dev servers.
So - am I missing something painfully obvious, or has anyone else noticed any issues with Perl on Cygwin?
In reply to Pattern Matching in Cygwin Perl vs. Win32 Perl by InsolentFlunkey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |