[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Testing list?



>>>>> "JP" == John Porter <jdporter@min.net> writes:


  JP>     my( $a, $b, $c ) = foo();

  JP>     ( $a, $b, $c ) ||= ( 1, 2, 3 );

  JP> and this:

  JP>     ( $a, $b, @c ) ||= ( 1, 2, 3, 4, 5 );

yecch!! that implies the || is applied to each member on the left side
and matching with the right side. perl doesn't do complex list
operations like that. i don't think it should even if you could come up
with reasonable syntax. but i gather you don't like this idea either.


  JP>     @a = foo();
  JP>     splice( @a, 2, 3 ) ||= ( 1, 2, 3 );

  JP>     ( @everything, $pred ) ||= genlist();
  JP>     # same as:
  JP>     $pred or @everything = genlist();
  JP>     # right?  

dunno. in the former if @everything already has stuff nothing gets
assigned (?) the latter is real perl and makes sense. it assigns based
on a boolean (or being lower precedence than =).

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe