in reply to Re: Can we do without auxiliary variable here?
in thread Can we do without auxiliary variable here?
print map { "$prefix$_" } split /\n/, join '', @_
Fixed:
print map { "$prefix$_" } split /^/m, join('', @_), -1;
Note: split implies the "m" for that pattern, but it's clearer to specify it.
Update: As Eliya kinda points out, there won't ever be null trailing fields with that pattern, so the above can be simplified to
print map { "$prefix$_" } split /^/m, join '', @_;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Can we do without auxiliary variable here?
by rovf (Priest) on Feb 28, 2011 at 17:12 UTC | |
by Eliya (Vicar) on Feb 28, 2011 at 17:48 UTC |