> >Let me shift gears and instead ask whether anyone thinks this: > > >> > $y = ($first, $second) = grep /$pat/, @data; > > >Returning "5" has any value? If you're going to do this, it seems like > >you'd want the number that were really returned (since scalar grep > >will give you the total number found anyways). > > Of course: the LHS is a known quantity; only the RHS is a mystery. > That's why it does this. I'm sure this in perldata. Well, it only does this if it's not something like 'split', then! So it's not 100% consistent. My point was whether or not this is important enough to be preserved? Or whether it could be bent a little to both add some better implicit counting features and optimize return values. Besides, you could always force the full count with: $y = ($first, $second, @junk) = grep /$pat/, @data; And just ignore @junk. If it were super-important that the LHS was always constant, then split wouldn't be able to be different. My point is that this might be something we could tweak to make other stuff better. -Nate
- Re: RFC 175 (v1) Add C<list> keyword to fo... Peter Scott
- Re: RFC 175 (v1) Add C<list> keyword to force list ... Damian Conway
- Re: RFC 175 (v1) Add C<list> keyword to force ... Tom Christiansen
- Re: RFC 175 (v1) Add C<list> keyword to fo... Steve Fink
- Re: RFC 175 (v1) Add C<list> keyword t... Graham Barr
- Re: RFC 175 (v1) Add C<list> keyword t... Tom Christiansen
- Re: RFC 175 (v1) Add C<list> keyword to fo... Nathan Wiger
- Re: RFC 175 (v1) Add C<list> keyword t... Tom Christiansen
- Change "($one, $two)=" behavio... Nathan Wiger
- Re: Change "($one, $two)="... Tom Christiansen
- Re: Change "($one, $two)="... Nathan Wiger
- Re: Change "($one, $two)="... Tom Christiansen
- Re: Change "($one, $two)="... Nathan Wiger
- Re: Change "($one, $two)="... Tom Hughes
- Re: Change "($one, $two)="... Jeremy Howard
- Re: Change "($one, $two)="... Damian Conway
- Re: Change "($one, $two)="... Tom Christiansen
- Re: Change "($one, $two)="... Nathan Wiger
- Re: Change "($one, $two)="... Peter Scott
- Re: Change "($one, $two)="... Jeremy Howard
- Re: Change "($one, $two)="... Nathan Wiger