On Mon, 2006-08-05 at 15:15 -0700, chen li wrote:
> Both line codes work perfectly:
>
> my @new_array = map { split } @arry;
> or
> my @new_array = split ' ', "@arry";
The second statement will work perfectly if every element has only one
space character separating its components and has no leading or trailing
spaces. A more general case would be to to split on whitespace:
my @new_array = split /\s+/, "@arry";
See `perldoc perlretut` and `perldoc perlre` for details.
--
__END__
Just my 0.00000002 million dollars worth,
--- Shawn
"For the things we have to learn before we can do them, we learn by doing them."
Aristotle
* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>