On Saturday 25 August 2007 18:45:11 James E Keenan wrote:
> Will Coleda wrote:
> > That's not how split(' ') works. Please re-read the perldoc quote above.
> Can split(' ') handle multiple wordspaces? tab characters?
> combinations thereof? (Just looking at it, I wouldn't expect it to.
> I'd only expect it to work on single wordspaces.)
Easy enough to show:
#!perl
use Test::More tests => 3;
my @words = split ' ', "\t \nHello\n \r\n\n\t world\n \t";
is( @words, 2, 'special string split finds only words' );
is( $words[0], 'Hello', '... discarding leading whitespace' );
is( $words[1], 'world', '... discarding trailing whitespace' );
-- c