Glenn Linderman wrote:
> The whole session is there in my message... I don't know how either, it
> was my first use of Benchmark, I cloned it from Rob & changed his 1
> (which produced a warning) to 10 (which didn't). And added a couple new
> cases.
>
> Clearly you got different results from
At 09:19 AM 4/20/2006 -0400, John Deighan wrote:
>And is there some reason that the compiler couldn't optimize that
>away by checking to see if there are any my's, labels, etc. and avoiding the
>setup in that case?
I don't know exactly what the compiler is doing with the code blocks. From
what
At 12:44 AM 4/20/2006, Chris Wagner wrote:
At 10:42 AM 4/20/2006 +1000, Sisyphus wrote:
>On the subject of replacing brackets with modifiers (which I think was also
>raised earlier on), I was surprised to find that using a modifier is about
>25% faster than brackets:
>'modifier' => 'for(@x) {$z1+
Glenn Linderman wrote:
> On approximately 4/19/2006 5:42 PM, came the following characters from
> the keyboard of Sisyphus:
>
>>- Original Message -
>>From: "Glenn Linderman"
>>.
>>.
>>
>>>I think that the
>>>
>>>for( grep ($_ != 3, @a))
>>>
>>>is quite clear in bundling the element sel
At 10:42 AM 4/20/2006 +1000, Sisyphus wrote:
>On the subject of replacing brackets with modifiers (which I think was also
>raised earlier on), I was surprised to find that using a modifier is about
>25% faster than brackets:
>'modifier' => 'for(@x) {$z1++ if $_ != 3}',
>'brackets' => 'for(@y) {if($
- Original Message -
From: "Glenn Linderman"
.
.
>
> Get a load of this variation:
>
> perl
> use warnings;
> no warnings "once";
> use Benchmark;
>
> @x = (1 .. 100);
> @y = (1 .. 100);
> @z = (1 .. 100);
> @w = (1 .. 100);
>
> $z1 = 0;
> $z2 = 0;
> $z3 = 0;
> $z4 = 0;
>
- Original Message -
From: "Glenn Linderman"
.
.
>
> I think that the
>
> for( grep ($_ != 3, @a))
>
> is quite clear in bundling the element selection together, and
> separating it from the functions being performed.
>
I would much rather see (as suggested earlier on in this thread):
f
@folders will have, at most 7 objects in it. All strings of less than
80 bytes.
Bill Ng
-Original Message-
From: Arms, Mike [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 19, 2006 5:24 PM
To: perl-win32-users@listserv.ActiveState.com
Cc: Ng, Bill
Subject: RE: Iffor
Bill, as long as
Bill Ng [bill.ng AT citigroup.com] wrote:
> Thanks,
>
> Just ordered it from Amazon. Went the super-cheap route and ordered
> it free shipping ... should have it in a week or so.
>
> If anyone cares, I ended up using this as my code ... it accomplished
> exactly what I was looking for:
>
g,
BillCc: perl-win32-users@listserv.ActiveState.comSubject:
Re: Iffor
Read Damian Conway's Perl Best Practices.
And when you feel the need to write clever code, read it
again.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.Act
ext\n";
foreach my $a (@a) {
next
if ($a == 3);
print
"$a\tsomething 3\n";
}
print "\nList::MoreUtils apply
method\n";
use List::MoreUtils qw(apply);
apply { print "$_\tsomething 4\n"
if ($_ != 3) } @a;
Regards,
... Dewey
"Ng, B
Ng, Bill wrote:
Performance isn't really what I'm going for, just simpler code.
If clear code is what you want, you won't get it using a 'next' as some
have suggested. A 'next' syntactically looks like any other line, and
is therefore not easily noticed as part of the control flow. Un
Ng, Bill wrote:
> Performance isn't really what I'm going for, just simpler code.
>
> For the past 4 years, I've been coding to get the job done, no
> matter how many lines it takes or how ugly it is to read, as
> long as it works that's fine. But recently you guys have shown
Read the last sentence of my email ... =)
Bill Ng
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Jerry Kassebaum
Sent: Tuesday, April 18, 2006 6:07 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: RE: Iffor
@a = (1,2,3,4,5);
for $x (@a
Ng, Bill asked on April 18, 2006 12:59 PM
> So if my array was:
> @a=(1,2,3,4,5);
> And we assume that I don't want to execute the block if the
> value of $_ is 3 ...
>
> Then, in my head, I'm looking for the WORKING (key word there)
> version of this:
> ---
> @a =
@a = (1,2,3,4,5);
for $x (@a)
{
if($x==3){next;}
print "$x\n";
}
##
You wrote:
Syntax issue (I think),
I'm trying to do the following:
I need to execute a block of instructions for all items in an array
except for one.
So if my array was:
@a=(1,2,3,4,5);
And we assu
seconds so performance
isn't much of an issue, just looking to tidy up the code. Thanks again.
Bill
-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 18, 2006 5:41 PM
To: Ng, Bill; perl-win32-users@listserv.ActiveState.com
Subject: RE: Iffo
esday, April 18, 2006 2:28 PM
To: 'Ng, Bill'; perl-win32-users@listserv.ActiveState.com
Subject: RE: Iffor
How about this?
###
use strict;
use warnings;
my @a = (1,2,3,4,5);
foreach(@a){
unless($_ == 3){
#do something...
}
}
###
-O
, 2006 12:59 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Iffor
So if my array was:
@a=(1,2,3,4,5);
And we assume that I don't want to execute the block if the value of $_
is 3 ...
Then, in my head, I'm looking for the WORKING (key word there) version
of this:
Bill Ng [bill.ng AT citigroup.com] wrote:
> Syntax issue (I think),
>
> I'm trying to do the following:
> I need to execute a block of instructions for all items in an array
> except for one.
>
> So if my array was:
> @a=(1,2,3,4,5);
> And we assume that I don't want to execute the block if the v
Syntax issue (I think),
I'm trying to do the following:
I need to execute a block of instructions for all items in an array
except for one.
So if my array was:
@a=(1,2,3,4,5);
And we assume that I don't want to execute the block if the value of $_
is 3 ...
Then, in my head, I'm looking for the W
21 matches
Mail list logo