Rather than split, I'd be more inclined to use a simple regex...
my $line = 'Filesystem 1K-blocks Used Available Use% +Mounted on'; my @fields = $line =~ /(\s*\S+)/g; print "[", join( "][", @fields ), "]\n"; __END__ [Filesystem][ 1K-blocks][ Used][ Available][ Use%][ Mou +nted][ on]
--k.
In reply to Re: Splitting without losing
by Kanji
in thread Splitting without losing
by anjiro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |