Skip to main content




submitted by /u/niceperl
[link] [comments]



I wanted a quick way to convert 255.255.255.252 -> 30 and other netmasks... this works!

$mask =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/ or next;
$cidr = 32 - (log(256-$1)+log(256-$2)+log(256-$3)+log(256-$4)) / log(2);

submitted by /u/sfxsf
[link] [comments]



I have been working as a freelance developer for the last 9 years, about 80% of that has been PHP based.

I just landed a big, possibly once in a lifetime client that has a just about 30 year old code base.

I am completely new to perl, I have done some crash course reading to understand syntax, operators etc.

For the most part I can read and understand the code, on my third day I discovered the architecture.

It's basically 4 systems in one root folder, each of those systems basically contain a package file and a index file which seems to contain the entire system within that that file.

There are references to templates (Template Toolkit) and other things outside the file but for the most part all the business logic is one file.

While going through this I realized there was non of the standards I had been accustomed to in PHP and other projects.

Archaic routing (basically none), the closest thing to a function an if statement that else ifs it's way down thousands of lines of code.

So I have some ideas to implement routing, modularity and probably convert the conditions to sub routines (we call these functions in my old club)

It's like take a journey back in time to an era that I was not around for.

With that being said, knowing what you know, what suggestions, secrets, tips or warnings would you be willing to share?

Edit: Great community! Who says perl is dead 😀 so many great resources, thank you so much! I will be spending a lot more time on this sub!

submitted by /u/Mowntain-Goat8414
[link] [comments]