>>>>> "DC" == Damian Conway <[EMAIL PROTECTED]> writes:

  DC> Uri Guttman wrote:
  >> so what that attribute does is force the hash to keep all pairs as
  >> single objects. but what about run time control of it? sometimes you
  >> might want a list of pairs to be handled like pairs and other times you
  >> want pairs to be scalars in a hash assignment. is there any way to
  >> manage that?

  DC> Sure. Just use the pairs as explicit keys and values:

  DC>   # Pairs as key/values...
  DC>   %hash = (a=>1, b=>2);
  DC>   %hash = @pairs;

but what about mixing pairs and scalars which was the core of this
thread? by default it seems assigning such a list to a hash would use
the pairs as 2 elements (and how does that handle even/odd slot
issues?). declaring the hash as pairs makes it take them as pairs during
assignment. but what if you had a mix of them in an array and needed to
control the way they get assigned to a hash. in some cases you want the
array fully listified (maybe a .list method on the array?) and in other
cases you want any pairs to remain as single elements be they key or
pair (default behavior?).

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to