Monks:
I have a large chunk of code where I am doing some heavy mathematical work and I would like to know if there are any options to define what type a variable is in order to avoid alot of the interpreter work with the loose/dynamic variable typing. I know that this is unlikely given it is a very non-Perl way of doing something but in short I would like to tell the interpreter that variable $foo is and will always be an integer for example, so don't bother checking if it is anything else. From my understanding, many operations that may be performed on $foo will check the type of the variable before proceeding, deciding how to do the operation.
Additionally, I know that rewriting in another language (C, C++) where this is available by default would provide these advantages, but this is not a good option given that the rest of the program is in Perl and I'm not a programmer by trade, so a C/C++ rewrite will take much longer than implementing the other solution if available. Additionally, it likely won't be a huge benefit in performance but now I'm more interested out of curiosity than anything else.
Thanks in advance for any thoughts on this. As a biochemist without a formal programming background, the PerlMonks site has been a great resource to me in the last few years both from answering the questions I have asked and the volume of stuff available from the questions of others
In reply to Anyway to Have Strong-Like Typing by jmmitc06
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |