Re: we need official libs : Swap
- Posted by "Lucius L. Hilley III" <lhilley at CDC.NET> Jul 20, 1999
- 460 views
I was silently and strongly supporting the syntax of {the_junk, the_value} = gets(0) Until, I saw the following possible implementation. > ---------------------- Information from the mail header ----------------------- > Poster: "Boehme, Gabriel" <gboehme at POBOXB1.HQ.MSMAIL.MUSICLAND.COM> > Organization: Musicland > Subject: Re: we need official libs : Swap > -------------------------------------------------------------------------- ----- > > {values[3], values[7]} = get(0) > > This could be okay -- even though we're referencing 'values' both times, > 'values[3]' and 'values[7]' are two different locations. But what happens > when we do this: > > {values[i], values[j]} = get(0) The only way I know to get around this mess is to either not allow {valu1, valu2} = function() OR to set the following rule. {the_value, the_value} = gets(0) --this equating to. obj = gets(0) the_value = obj[1] the_value = obj[2] I don't see any problems with the syntax of {hr, mn, sc, mh, dy, yr} = {cur_hr, cur_mn, cur_sc, cur_mh, cur_dy, cur_yr} Assume you don't want the {hour, min, sec} but only want the {month, day, year}. You should still include the first 3 as placeholders. However, If you only want the {hour, min, sec} and don't want the rest. You should be able to do the following. {hour, min, sec} = {cur_hr, cur_mn, cur_sc, cur_mh, cur_dy, cur_yr} The remaining 3 are simply dropped or ignored. The more I look at this PERLish code the scarier it gets. I think I will go hide under the bed now. Lucius L. Hilley III lhilley at cdc.net +----------+--------------+--------------+ | Hollow | ICQ: 9638898 | AIM: LLHIII | | Horse +--------------+--------------+ | Software | http://www.cdc.net/~lhilley | +----------+-----------------------------+