On Wed, Aug 16, 2000 at 10:27:17AM -0400, Karl Glazebrook wrote: > Nathan Torkington wrote: > > * current typing provides rudimentary compile-type checking. > > Saying: > > $foo = (1,3,5); > > gives a warning. Saying: > > this would create a $foo array If () are array constructors, what is the hash constructor? $array = (1,2,3); $hash = qw(when Now where Here why Because); # Is it a hash? Well, now that I've asked the question, I've thought of an answer ... just use Damian Conway's pair constructor: $hash = ('when' => 'Now', 'where' => 'Here', 'why' => 'Because'); Hmm. I wonder how you'd pairify a list though? Could that be one of the unzip() or partition() routines? Random musings (combining this and John Porter's collapse of arrays and hashes): $list = qw(when Now where Here why Because); while ($list) { $hash[shift $list] = shift $list; } $odds = map { $_%2 && $list[$_] } 0..$#list; $evens = map { $_%2==0 && $list[$_] } 0..$#list; $hash[$evens] = $odds; for ($i = 0; $i < scalar($list); $i+=2) { $hash[list[$i]] = $list[$i+1]; } Gee, I'd hate to lose simple assignment to a hash from a list. What happens to $_ and @_? How do I get the arguments passed to a sub? -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]
- Re: RFC 109 (v1) Less line noise - let's get ... John Barnette
- Re: RFC 109 (v1) Less line noise - let's ... Jonathan Scott Duff
- Re: RFC 109 (v1) Less line noise - le... John Barnette
- Re: RFC 109 (v1) Less line noise - let's ... John Porter
- Re: RFC 109 (v1) Less line noise - let's get ... Russ Allbery
- Re: RFC 109 (v1) Less line noise - let's get rid ... Kai Henningsen
- Re: RFC 109 (v1) Less line noise - let's get ... Mike Pastore
- Re: RFC 109 (v1) Less line noise - let's get ... Russ Allbery
- Re: RFC 109 (v1) Less line noise - let's get rid of @% Nathan Torkington
- Re: RFC 109 (v1) Less line noise - let's get rid ... Karl Glazebrook
- Re: RFC 109 (v1) Less line noise - let's get ... Jonathan Scott Duff
- Re: RFC 109 (v1) Less line noise - let's ... John Porter
- Re: RFC 109 (v1) Less line noise - le... Jonathan Scott Duff
- Re: RFC 109 (v1) Less line noise... John Porter
- Re: RFC 109 (v1) Less line noise - le... Jarkko Hietaniemi
- Re: RFC 109 (v1) Less line noise - let's get rid ... Kai Henningsen
- Re: RFC 109 (v1) Less line noise - let's get ... Karl Glazebrook
- Re: RFC 109 (v1) Less line noise - let's ... Nathan Torkington
- Re: RFC 109 (v1) Less line noise - le... John Porter
- Re: RFC 109 (v1) Less line noise - let's ... Damien Neil
- Re: RFC 109 (v1) Less line noise - le... Karl Glazebrook