OK, it is a potential pitfall, but why would you expect a single value (or list of size 1) to get stretched automatically as big as the size of the list you're using in the hash slice? Better to do something like:
@netmask{@mymachines} = "255.255.0.0" x scalar @mymachines;
Which makes your intent as obvious as it could be.
Update Fastolfe reminds me that the above code won't do what I want it to. (it would generate a scalar that consists of the size of @mymachines iterations of "255.255.0.0" -- list context confuses me yet again! =) To get a list as long as @mymachines, you need to do
@netmask{@mymachines} = ("255.255.0.0") x scalar @mymachines;
Philosophy can be made out of anything. Or less -- Jerry A. Fodor
In reply to RE: RE: RE: Re: Possible pitfall with Slices
by arturo
in thread Possible pitfall with Slices
by fundflow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |