Function
Function copied to clipboard
Perl 5 implementation
there is always more than one way to do it.
Somewhere perl lacks functionality, so i try to propose (readable) analogues.
Oh gosh... Perl. I don't even know who can review this.
I hope now it's ready.