# Using libraries in solutions

Languages differ greatly in the amount of functionality contained in the main namespace. Most of the PHP main functions, have counterparts in Perl core libraries. What should the policy be on character counts in such cases?

For example, my solution for the NxN spiral used the Perl library Math::Complex. Possible outcomes:

• Allow command-line calls such as perl -MMath::Complex script.pl to include libraries.
• Require use Math::Complex; in the code.
• Do not allow libraries.

Of course, this is just another instance of the problem of trying to compare languages, but there is some value in defining an objective measure.

I'd say use

use Math::Complex;


and be done with it. If PHP can solve something shorter than Perl because Perl requires a module, then so be it. I cringe every time I have to write [Math]::floor() or something like that because it's so verbose, but it still is a trait of the language.

And some languages are better for golfing certain problems than others. I guess there is no point in denying that.

• Languages do indeed have different advantages, but then the question is: which command-line parameters would be allowed? – user475 Feb 10 '11 at 14:06
• @Tim: The usual answer is: command-line arguments count towards the character count. – Chris Jester-Young Feb 10 '11 at 14:20

My opinion is that, unless the question says otherwise, any freely available library existing before the question was asked should be permissible. However, the requisite import statements should be counted towards the byte count. Additionally, a link to the library should be included in the description/explanation part of the answer.

• You should include relevant imports in the count, no matter if it is a complete program or function. – Geobits Aug 4 '15 at 14:30