Fwd: Re: dangerous perl (Re: is this reasonably save?)

2017-05-24 Thread Uri Guttman
private IMO> On 05/24/2017 08:20 PM, lee wrote: Uri Guttman writes: you can get an array of hashes, where each hash is one row. learning dereferencing will do you much more good than using eval EXPR. references are key to deeper data structures in perl and are used all over the place. it is

Re: project euler #8

2017-05-24 Thread lee
Ok, here's one more: [...] unless($ad) { print " * $ad = 0\n"; $start = $digit; next DIGITS; } [...] You can skip right away to behind the 0 which has already been found within the current range of adjacency. lee writes: > Sorry, I was too fast and I got

Re: Time::HiRes output

2017-05-24 Thread lee
"Chas. Owens" writes: > You can use printf or sprintf to control the format, but what you are doing > is called profiling and it is better to use an actual profiler. Take a look > at Devel::NYTProf > > http://search.cpan.org/~timb/Devel-NYTProf-6.04/lib/Devel/NYTProf.pm > > https://www.perl.org/a

Re: project euler #8

2017-05-24 Thread lee
Sorry, I was too fast and I got it all wrong. It goes like this: [...] my $adjacency = 13; my $maxprod = 0; my $start = 0; my $exceed = length($data); my $end = $exceed - $adjacency; DIGITS: while($start < $end) { my $prod = substr($data, $start, 1); print $prod; if($prod) { my $ad

Re: Time::HiRes output

2017-05-24 Thread Chas. Owens
You can use printf or sprintf to control the format, but what you are doing is called profiling and it is better to use an actual profiler. Take a look at Devel::NYTProf http://search.cpan.org/~timb/Devel-NYTProf-6.04/lib/Devel/NYTProf.pm https://www.perl.org/about/whitepapers/perl-profiling.html

Time::HiRes output

2017-05-24 Thread SSC_perl
I’m timing sub routines to get an idea of where my scripts spend the most of their time. This is an example of what I’m doing: use Time::HiRes qw( clock ); my $clock0 = clock(); ... # Do something. my $clock1 = clock(); my $clockd = $clock1 - $clock0; I’m getting values like $cl

Re: project euler #8

2017-05-24 Thread lee
Shlomi Fish writes: > Hi all! > > Resending because the original message does not appear to have arrived at the > list. > > = > > Hi Derrick, > > On Tue, 16 May 2017 14:01:34 +0800 > derr...@thecopes.me wrote: > >> Hi All, >> >> I am working on problem #8 of the euler project. see below. >>

Re: is this reasonably save?

2017-05-24 Thread lee
Shawn H Corey writes: > On Sun, 14 May 2017 18:16:50 +0100 > lee wrote: > >> Ok, do you see a way to do what I'm doing here by evaluating a block? >> > > Simply remove it. > > $sth_cmds->bind_columns(@params); But then the program doesn't work anymore ... -- "Didn't work" is an error.