in reply to Searching a collection of signatures
First of all, its always safer to use chomp, since it will only remove whatever your OS uses for newlines. If there isn't a newline after the last sig in your file, your chop version will remove the last char in the sig, chomp wont.map {chop} @sigs;
Second we're calling map in void context which is expensive. map generates a new array for us, that we don't need or use -- i.e. @newarray = map {chomp} @sigs; Such "void maps" are better written as for loops...map {chomp} @sigs;
But as it turns out, chomp can take a list as an argument, so the above line can be shortened to:chomp for @sigs;
chomp @sigs;
-Blake
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re(2): Searching a collection of signatures
by FoxtrotUniform (Prior) on Nov 07, 2001 at 11:58 UTC | |
by blakem (Monsignor) on Nov 07, 2001 at 12:31 UTC |