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
In reply to Re: Regular Expression
by Zaxo
in thread Regular Expression
by optikool
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |