Re: Trimming arrays

2009-01-14 Thread Ovid
- Original Message From: Patrick R. Michaud pmich...@pobox.com I would expect this to be roughly equivalent to: for @array { $_ .= trim; } For an array of hashes, this would result in each hash element of @array being replaced with a reference to an array of the

Re: Trimming arrays

2009-01-14 Thread Patrick R. Michaud
On Wed, Jan 14, 2009 at 03:37:57AM -0800, Ovid wrote: - Original Message From: Patrick R. Michaud pmich...@pobox.com Oops -- I over-referenced here. The corrected form: For C @array».=trim , each element of @array would be replaced with its trimmed string representation.

Re: Trimming arrays

2009-01-13 Thread Aristotle Pagaltzis
* Ovid publiustemp-perl6langua...@yahoo.com [2009-01-13 00:35]: * Larry Wall la...@wall.org [2009-01-13 00:25]: It should probably say No such method. We have hyperops now to apply scalar operators to composite values explicitly: @array».=trim Won't that fail with 'No such method' on

Re: Trimming arrays

2009-01-13 Thread Patrick R. Michaud
On Mon, Jan 12, 2009 at 03:30:05PM -0800, Ovid wrote: From: Larry Wall la...@wall.org : my @array = ' foo ', ' bar '; : @array .= trim; : say @array.perl; : : And what if I have an array of hashes of hashes of arrays? : : Currently you can call 'trim' on arrays, but

Re: Trimming arrays

2009-01-13 Thread Moritz Lenz
Ovid wrote: What should this output? my @array = ' foo ', ' bar '; @array .= trim; say @array.perl; And what if I have an array of hashes of hashes of arrays? Currently you can call 'trim' on arrays, but it's a no-op. Similar issues with chomp and friends. I think

Re: Trimming arrays

2009-01-13 Thread Patrick R. Michaud
On Tue, Jan 13, 2009 at 08:19:25AM -0600, Patrick R. Michaud wrote: @array».=trim Won't that fail with 'No such method' on an array of hashes? Or are hyperops applied recursively? I would expect this to be roughly equivalent to: for @array { $_ .= trim; } For an array

Trimming arrays

2009-01-12 Thread Ovid
What should this output? my @array = ' foo ', ' bar '; @array .= trim; say @array.perl; And what if I have an array of hashes of hashes of arrays? Currently you can call 'trim' on arrays, but it's a no-op. Similar issues with chomp and friends. Cheers, Ovid -- Buy the book

Re: Trimming arrays

2009-01-12 Thread Larry Wall
On Mon, Jan 12, 2009 at 03:05:21PM -0800, Ovid wrote: : What should this output? : : my @array = ' foo ', ' bar '; : @array .= trim; : : say @array.perl; : : And what if I have an array of hashes of hashes of arrays? : : Currently you can call 'trim' on arrays, but it's a no-op.

Re: Trimming arrays

2009-01-12 Thread Ovid
- Original Message From: Larry Wall la...@wall.org : my @array = ' foo ', ' bar '; : @array .= trim; : : say @array.perl; : : And what if I have an array of hashes of hashes of arrays? : : Currently you can call 'trim' on arrays, but it's a no-op. Similar