in reply to Re: how to speed up program dealing with large numbers?
in thread how to speed up program dealing with large numbers?

1) I have v5.8.9 installed, should i be putting that in a use line atop my code

2) Good to know, yeah thats a C++ habbit. This makes me like perl even more.

3) Interesting, yeah I wouldn't expect either of those to work. Why does the increment operator work on an uninitialized variable when other math operators don't?

  • Comment on Re^2: how to speed up program dealing with large numbers?

Replies are listed 'Best First'.
Re^3: how to speed up program dealing with large numbers?
by GrandFather (Saint) on Mar 22, 2010 at 04:44 UTC

    1/ no. Although Perl 5.10 has some nice features that it is worth upgrading to for. say and the new switch processing are nice.

    2/ You ought not be doing that in C++ either! C requires declarations to all be at the start of a block, but in C++ you can put em anywhere.

    3/ The increment and update assignment (+=, *=, .=, ...) treat undef as a special case and "do the right thing". Perl has a fair bit of DWIMery (Do What I Mean) and this is one aspect of that.


    True laziness is hard work

      1) Cool, I'll run a portupgade on perl, thanks.

      2) Really, I had been taught that it was at least convention, if not necessary, and I have seen others C++ code that does that.

      3) Interesting, good to know. Thats really cool.

      And again, thanks for all the great info.

        The declaration 'convention' is probably used by C programmers who have migrated to C++, but haven't adapted to it. C requires all declarations at the start. C++ (and Perl, among many other languages) allows declarations wherever you need them pretty much. The advantage is that declaration and initialisation can be done at the same time so the region in which the variable is used is clearer.


        True laziness is hard work
Re^3: how to speed up program dealing with large numbers?
by 7stud (Deacon) on Mar 22, 2010 at 07:48 UTC
    1) I would upgrade to perl 5.10+ for say() alone. Having to write "\n" at the end of a print() statement every time will take years off your life. say() is equivalent to print() with a newline at the end of the output.
      Except that you spend those years anyway reading programs that alternate between say and print depending on whether they're printing full lines of output at a time.