Community backlog for Perl
Expert validation
It is extremely valuable to curate the Perl contents. Would you like to review these implementations?
If they can be improved, please help yourself. If you know a better way, please create a distinct entry. If they're broken, please flag them.
🗘
Idiom #27 Create a 3-dimensional arrayDeclare and initialize a 3D array x, having dimensions boundaries m, n, p, and containing real numbers. |
||
|
|
|
Idiom #127 Source code inclusionImport the source code for the function foo body from a file "foobody.txt". |
||
|
|
|
Idiom #200 Return hypotenuseCompute the hypotenuse h of the triangle where the sides adjacent to the square angle have lengths x and y. |
||
|
|
|
For many more Perl snippets to curate, see the full list.
Docs & demos
🗘
Idiom #80 Truncate floating point number to integerDeclare integer y and initialize it with the value of floating point number x . Ignore non-integer digits of x . |
||
|
|
|
Idiom #67 Binomial coefficient "n choose k"Calculate binom(n, k) = n! / (k! * (n-k)!). Use an integer type able to handle huge numbers. |
||
|
|
|
Idiom #117 Get list sizeSet n to the number of elements of the list x. |
||
|
|
|
75% of the Perl snippets don't have a runnable demo yet.
For example, these implementations would need a demo URL:
Idiom #209 Type with automatic deep deallocationDeclare a type t which contains a string s and an integer array n with variable size, and allocate a variable v of type t. Allocate v.s and v.n and set them to the values "Hello, world!" for s and [1,4,9,16,25], respectively. Deallocate v, automatically deallocating v.s and v.n (no memory leaks). |
||
|
|
|
Idiom #3 Create a procedureLike a function which doesn't return any value, thus has only side effects (e.g. Print to standard output) |
||
|
|
|
Idiom #7 Iterate over list indexes and valuesPrint each index i with its value x from an array-like collection items |
||
|
|
|
Missing implementations
🗘A Perl implementation is missing for 12 idioms out of 344 idioms.
You may help by writing a Perl snippet for these idioms:
|
Idiom #341 Find substring last positionSet i to the position of the last occurrence of the string y inside the string x, if exists. |
|
Idiom #342 Leap year?Determine if the current year is a leap year. |
|
Idiom #345 Convert string to big integerCreate the integer value i initialized from its string representation s (in radix 10) |