in reply to Regular Expression
or just my @matches = grep { chomp; /a$/ } <DICT>;while (my $words = <DICT>) { chomp $words; push @matches, $words if $words =~ /a$/ }
Update: With CountZero's caveat, the second example will work fine on windows. That is Perl's internal grep, not the unix system utility of the same name. Perl chomp removes whatever $/ is from the end of a string - by default that is the native newline.
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regular Expression
by CountZero (Bishop) on May 18, 2003 at 07:20 UTC | |
|
Re: Re: Regular Expression
by optikool (Novice) on May 18, 2003 at 21:54 UTC | |
by graff (Chancellor) on May 19, 2003 at 01:43 UTC | |
by hangmanto (Monk) on May 19, 2003 at 00:17 UTC |