On Wed, 20 Nov 2002 10:35:11 -0600, [EMAIL PROTECTED] (Steven Lembark) wrote:
> -- Andrew Molyneux <[EMAIL PROTECTED]> > > > I'd probably do: > > my ($max, $sep, $end) = @_; > > Yes, becuase if you did it this way you'd get $end equal > to the integer coult of the number of list arguments passed > plus one for the end value. Huh? $end gets assigned $_[2]. I'm not sure where you get an "integer coult" from. > Notice the usage: > > my $string = commify 90, ', ', 'etc...', @names; Those parameters get flattened into a list @_. @names doesn't know that there's an assignment to a scalar in the subroutine; it gives up its identity and becomes part of the list. And anyway, it's a list context assignment. The first three elements of @_ get assigned to $max, $sep, and $end (respectively); all further elements get ignored. Similar to my ($ss, $mm, $hh) = localtime; or my ($foo, $bar, baz) = (1 .. 10); > The other problem is that even if there were only three > arguments being passed in you have to check the count > before making the assignment and croak on @_ != 3 in > order to avoid an extra parameter causing $end to > become an integer count. Why? IDGI. Cheers, Philip