in reply to Using map to Add a Line Breaks to a List
The direct fix:
print map { /(.+)\./ && "$1\n" } sort RetrieveIllustrationList( $cl_us +erinput );
The subtle fix (my recommendation):
print map { /(.+)\./, "\n" } sort RetrieveIllustrationList( $cl_userin +put );
Doing a lot of extra work with a dash of join:
print join "\n", map( /(.+)\./, sort RetrieveIllustrationList( $cl_use +rinput ) ), '';
Letting print do the work with an implicit version of the subtle fix (probably the most efficient, but caveat microoptimizer):
local $, = "\n"; print map( /(.+)\./, sort RetrieveIllustrationList( $cl_userinput ) ), + '';
Suboptimal variations with a double loop:
print map "$_\n", map /(.+)\./, sort RetrieveIllustrationList( $cl_use +rinput ); print "$_\n" for map /(.+)\./, sort RetrieveIllustrationList( $cl_user +input );
I think that's enough for tonight.
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using map to Add a Line Breaks to a List
by goober99 (Scribe) on Mar 05, 2005 at 06:07 UTC | |
by Aristotle (Chancellor) on Mar 05, 2005 at 08:04 UTC | |
by !1 (Hermit) on Mar 05, 2005 at 06:17 UTC | |
by Aristotle (Chancellor) on Mar 05, 2005 at 07:56 UTC |