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 > > > > Oops -- I over-referenced here. The corrected form: > > > > For C< @array».=trim >, each element of @array would be replaced > > with its trimmed string representation. If

Re: Trimming arrays

2009-01-14 Thread Ovid
- Original Message > From: Patrick R. Michaud > > 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 > > trimmed

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; } > >

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.

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 > > : 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, bu

Re: Trimming arrays

2009-01-13 Thread Aristotle Pagaltzis
* Ovid [2009-01-13 00:35]: >* Larry Wall [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 an array of hashes? Or > are hyperops

Re: Trimming arrays

2009-01-12 Thread Ovid
- Original Message > From: Larry Wall > : 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 >

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.