Re: calculate within a loop

2016-09-21 Thread Chris Charley
""Chris Charley"" wrote in message news:20160912202839.22177.qm...@lists-nntp.develooper.com... "Nathalie Conte" wrote in message news:9d0654e0-8ec0-4051-87ca-541f90931...@ebi.ac.uk... Dear all, Thanks a lot for the codes various people which all

Re: calculate within a loop

2016-09-14 Thread Chris Charley
""Chris Charley"" wrote in message news:20160912202839.22177.qm...@lists-nntp.develooper.com... "Nathalie Conte" wrote in message news:9d0654e0-8ec0-4051-87ca-541f90931...@ebi.ac.uk... Dear all, [snip] many thanks again for any tips/help, Nathalie

Re: calculate within a loop

2016-09-12 Thread Uri Guttman
On 09/12/2016 06:48 PM, Aaron Wells wrote: @Jim, That eval bit i think Nathalie got from me. I need to review my core Perl. I think i’m in the habit of assuming Perl warns against any usage of undefined values, even in boolean context. Not so. I’ve proven to myself that this is not the case:

Re: calculate within a loop

2016-09-12 Thread Aaron Wells
@Jim, That eval bit i think Nathalie got from me. I need to review my core Perl. I think i’m in the habit of assuming Perl warns against any usage of undefined values, even in boolean context. Not so. I’ve proven to myself that this is not the case: $ perl -E’ >my ($foo, $bar); # these aren’t

Re: calculate within a loop

2016-09-12 Thread Chris Charley
"Nathalie Conte" wrote in message news:9d0654e0-8ec0-4051-87ca-541f90931...@ebi.ac.uk... Dear all, Thanks a lot for the codes various people which all work perfectly!! I have also discover some useful functions (eval and state) which can also be very helpful for this kind

Re: calculate within a loop

2016-09-12 Thread Jim Gibson
> On Sep 12, 2016, at 6:24 AM, Nathalie Conte wrote: > > Dear all, > > Thanks a lot for the codes various people which all work perfectly!! I have > also discover some useful functions (eval and state) which can also be very > helpful for this kind of data. > > In the

Re: calculate within a loop

2016-09-12 Thread Nathalie Conte
Dear all, Thanks a lot for the codes various people which all work perfectly!! I have also discover some useful functions (eval and state) which can also be very helpful for this kind of data. In the light of this, my dataset got more complicated, now there are 3 layers of hashes and I need

Re: calculate within a loop

2016-09-10 Thread Aaron Wells
Hi there, Me again. The sort function does NOT default to <=>. It defaults to string comparison order. See the Perl doc for sort: "If SUBNAME or BLOCK is omitted, sorts in standard string comparison order. " So assuming you want numbers sorting, 'sort { $a <=> $b } keys %{$nameref}' would be the

Re: calculate within a loop

2016-09-10 Thread Jim Gibson
> On Sep 9, 2016, at 8:54 AM, Nathalie Conte wrote: > > Hello, > I have a question about making a calculation within a loop > > I have a hash of hashes > ## > #!/usr/bin/perl > use strict; > use warnings; > > use Data::Dumper qw(Dumper); > > my %grades; >

Re: calculate within a loop

2016-09-09 Thread Gil Magno
Hi, Nathalie You could try the attached code. Best gil On 09/09/16 12:54, Nathalie Conte wrote: > Hello, > I have a question about making a calculation within a loop > > I have a hash of hashes > ## > #!/usr/bin/perl > use strict; > use warnings; > > use Data::Dumper

calculate within a loop

2016-09-09 Thread Nathalie Conte
Hello, I have a question about making a calculation within a loop I have a hash of hashes ## #!/usr/bin/perl use strict; use warnings; use Data::Dumper qw(Dumper); my %grades; $grades{"Foo "}{1} = 97; $grades{"Foo "}{2}= 107; $grades{"Peti "}{1} = 88; $grades{"Peti "}{3}