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
On Mon, 25 Nov 2002 11:34:23 + (GMT), [EMAIL PROTECTED] wrote:
$i = 20;
my($x, $y, $z) = ($i++, $i, $i++);
Now, it appears that perl's evaluation order is accident rather than
design - so you SHOULD NOT rely on it. Avoid causing side-effects on
variables you use more than once...
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
* 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
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
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
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
--- 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
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
-- 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,
-- 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
-- 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
* 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
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
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
* 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
-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,
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 );
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
* 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
-- 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 );
...
-- 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
-- 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 (
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
24 matches
Mail list logo