in reply to Vow Triptych
my@wordsInOrder; while (<>) { foreach ("$_" =~ m/\w+/g) { push @wordsInOrder, lc($_); } }
Wow! You are copying $_ to a string before binding it to a match and then iterating over a list in a loop when you could just use the list directly:
my@wordsInOrder; while (<>) { push @wordsInOrder, lc() =~ m/\w+/g; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Vow Triptych
by hashED (Novice) on Dec 30, 2008 at 17:23 UTC |
In Section
Cool Uses for Perl