in reply to -F and trailing empty fields
Split uses $_ as its default argument and delivers its data into @_ unless assigned so:
C:\>type test.txt a,b,c,d,e,f a,,c,,e, a,b,c,,, C:\>perl -pe "split/,/;$_=join'!',@_" test.txt a!b!c!d!e!f a!!c!!e! a!b!c!!!
Yours is longer but to be fair if I golf it down it works out exactly the same number of characters, however this does as you want, except @F is @_. It looks like dropping the empty fields is an apparently undocumented feature.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: -F and trailing empty fields
by KurtSchwind (Chaplain) on Apr 30, 2008 at 17:33 UTC | |
by tachyon-II (Chaplain) on Apr 30, 2008 at 17:38 UTC |