Re: Function parameter passing (was: Re: limit the list)

2002-11-25 Thread Jonathan E. Paton
You may be in luck, and it may do precisely what you want, but by the time you made sure it does, you've already wasted far too much time on it. Here is an example that mosty likely *not* do what you want: $i = 20; my($x, $y, $z) = ($i++, $i, $i++); This is a great example, as

Re: Function parameter passing (was: Re: limit the list)

2002-11-21 Thread csaba . raduly
On 21/11/2002 09:49:59 Jonathan E. Paton wrote: [snip: order of evaluation] Now, many Perl experts will have experience in other languages, such as C where this is suicidal for portable code. C doesn't specify order, so that the order of evaluation can be changed for optimisation. I had to

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread A. Pagaltzis
* Andrew Molyneux [EMAIL PROTECTED] [2002-11-20 12:47]: You're not the only one. I'd probably do: my ($max, $sep, $end) = @_; aolme too/aol but I'd love to know if Steven had a specific reason for doing it the other way. There doesn't seem to be any here. -- Regards, Aristotle

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Abigail
On Wed, Nov 20, 2002 at 11:42:43AM +0100, Bart Lateur wrote: On Wed, 20 Nov 2002 04:10:02 -0600, Steven Lembark wrote: sub commify { my ( $max, $sep, $end ) = ( shift, shift, shift ); ... } Wow! Hold it! Am I the only one who finds this absurd? More than one shift on the

RE: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Moran, Matthew
Abigail wondered: Why is that bad style? Many times when people say it's bad style, it's just a case of beauty is in the eye of the beholder. Strikes me that instead of using one move to assign the variables, it's using three. Matt

RE: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Bernie Cosell
On 20 Nov 2002 at 13:43, Moran, Matthew wrote: Abigail wondered: Why is that bad style? Many times when people say it's bad style, it's just a case of beauty is in the eye of the beholder. Strikes me that instead of using one move to assign the variables, it's using three. Just

Re: AW: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Jonathan E. Paton
--- Pense, Joachim [EMAIL PROTECTED] wrote: Von: Moran, Matthew [mailto:[EMAIL PROTECTED]] Gesendet am: Mittwoch, 20. November 2002 14:41 Joachim suggested: sub commify { my $max = shift; my $sep = shift; my $end = shift; ... } better or even worse in

Re: AW: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Jeremy Impson
On Wed, 20 Nov 2002, Pense, Joachim wrote: Bart Lateur [mailto:[EMAIL PROTECTED]] wrote: (Mittwoch, 20. November 2002 11:43) On Wed, 20 Nov 2002 04:10:02 -0600, Steven Lembark wrote: sub commify { my ( $max, $sep, $end ) = ( shift, shift, shift ); ... } Wow! Hold it! Am I

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Steven Lembark
-- Bart Lateur [EMAIL PROTECTED] On Wed, 20 Nov 2002 04:10:02 -0600, Steven Lembark wrote: sub commify { my ( $max, $sep, $end ) = ( shift, shift, shift ); ... } Wow! Hold it! Am I the only one who finds this absurd? More than one shift on the same array in one single expressing,

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Steven Lembark
-- Andrew Molyneux [EMAIL PROTECTED] Wow! Hold it! Am I the only one who finds this absurd? More than one shift on the same array in one single expressing, sounds like bad style to me. Comments? You're not the only one. I'd probably do: my ($max, $sep, $end) = @_; but I'd love to know

Re: AW: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Steven Lembark
-- Pense, Joachim [EMAIL PROTECTED] Bart Lateur [mailto:[EMAIL PROTECTED]] wrote: (Mittwoch, 20. November 2002 11:43) On Wed, 20 Nov 2002 04:10:02 -0600, Steven Lembark wrote: sub commify { my ( $max, $sep, $end ) = ( shift, shift, shift ); ... } Wow! Hold it! Am I the only one who

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread A. Pagaltzis
* Steven Lembark [EMAIL PROTECTED] [2002-11-20 17:35]: 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. Notice the usage: my $string = commify 90, ', ', 'etc...', @names; The other

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Andrew Molyneux
Steven Lembark wrote: 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. Notice the usage: my $string = commify 90, ', ', 'etc...', @names; D'oh! (slaps head). Serves me right for not reading your

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Philip Newton
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

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread A. Pagaltzis
* Steven Lembark [EMAIL PROTECTED] [2002-11-20 20:51]: Look up what happens to arrays in a scalar context. my ( $a, $b, $c ) = qw( foo bar bletch blort bim bam blort ); what do yo get for $c? 'bletch' - and that's not an array there. -- Regards, Aristotle

RE: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Alistair . McGlinchy
-Original Message- From: Steven Lembark [mailto:[EMAIL PROTECTED]] -- Philip Newton [EMAIL PROTECTED] 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,

Re: AW: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Vladi Belperchinov-Shabanski
On Wed, 20 Nov 2002 13:34:40 - Pense, Joachim [EMAIL PROTECTED] wrote: Bart Lateur [mailto:[EMAIL PROTECTED]] wrote: (Mittwoch, 20. November 2002 11:43) On Wed, 20 Nov 2002 04:10:02 -0600, Steven Lembark wrote: sub commify { my ( $max, $sep, $end ) = ( shift, shift, shift );

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Peter Scott
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Abigail) writes: On Wed, Nov 20, 2002 at 11:42:43AM +0100, Bart Lateur wrote: On Wed, 20 Nov 2002 04:10:02 -0600, Steven Lembark wrote: sub commify { my ( $max, $sep, $end ) = ( shift, shift, shift ); ... } Wow! Hold it! Am I

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread A. Pagaltzis
* Andrew Molyneux [EMAIL PROTECTED] [2002-11-20 18:25]: A. Pagaltzis wrote: Enter splice. my ($max, $sep, $end) = splice @_, 0, 3; That has brevity, certainly, but for legibility, I think I prefer Steven's original (shift,shift,shift) Really? I find the splice version a lot easier on

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Steven Lembark
-- Peter Scott [EMAIL PROTECTED] In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Abigail) writes: On Wed, Nov 20, 2002 at 11:42:43AM +0100, Bart Lateur wrote: On Wed, 20 Nov 2002 04:10:02 -0600, Steven Lembark wrote: sub commify { my ( $max, $sep, $end ) = ( shift, shift, shift ); ...

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Steven Lembark
-- Philip Newton [EMAIL PROTECTED] hat happens when you do @a = qw( foo bar bletch blort bim bam blort ); my ( $a, $b, $c ) = @a; ? Obviously a better example. Point is that $c is one item on the list, but $a, $b, and $c are still on the list. Given that the original code used the

Re: AW: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Steven Lembark
-- Vladi Belperchinov-Shabanski [EMAIL PROTECTED] On Wed, 20 Nov 2002 13:34:40 - Pense, Joachim [EMAIL PROTECTED] wrote: Bart Lateur [mailto:[EMAIL PROTECTED]] wrote: (Mittwoch, 20. November 2002 11:43) On Wed, 20 Nov 2002 04:10:02 -0600, Steven Lembark wrote: sub commify { my (

Re: Function parameter passing (was: Re: limit the list)

2002-11-20 Thread Paul Johnson
On Wed, Nov 20, 2002 at 08:46:25PM -, Peter Scott wrote: [EMAIL PROTECTED] (Steven Lembark) writes: -- Peter Scott [EMAIL PROTECTED] In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Abigail) writes: On Wed, Nov 20, 2002 at 11:42:43AM +0100, Bart Lateur wrote: On Wed, 20 Nov 2002