Many a network admin has turned to the siren song of Perl to help them automate managing their networks. Frank‘s predecessor is no exception.
They also got a bit combative about people critiquing their Perl code:
<span class="hljs-comment"># COMPLEX SUBNET MATH</span>
<span class="hljs-comment"># Looking up a value in an array was faster than any mathematical solution. Yes, it's hard coded, but these values won't ever change anyway. Stop being so #### about it.</span>
$Subnets = @(<span class="hljs-string">"0.0.0.0"</span>,<span class="hljs-string">"128.0.0.0"</span>,<span class="hljs-string">"192.0.0.0"</span>,<span class="hljs-string">"224.0.0.0"</span>,<span class="hljs-string">"240.0.0.0"</span>,<span class="hljs-string">"248.0.0.0"</span>,<span class="hljs-string">"252.0.0.0"</span>,<span class="hljs-string">"254.0.0.0"</span>,<span class="hljs-string">"255.0.0.0"</span>,<span class="hljs-string">"255.128.0.0"</span>,<span class="hljs-string">"255.192.0.0"</span>,<span class="hljs-string">"255.224.0.0"</span>,<span class="hljs-string">"255.240.0.0"</span>,<span class="hljs-string">"255.248.0.0"</span>,<span class="hljs-string">"255.252.0.0"</span>,<span class="hljs-string">"255.254.0.0"</span>,<span class="hljs-string">"255.255.0.0"</span>,<span class="hljs-string">"255.255.128.0"</span>,<span class="hljs-string">"255.255.192.0"</span>,<span class="hljs-string">"255.255.224.0"</span>,<span class="hljs-string">"255.255.240.0"</span>,<span class="hljs-string">"255.255.248.0"</span>,<span class="hljs-string">"255.255.252.0"</span>,<span class="hljs-string">"255.255.254.0"</span>,<span class="hljs-string">"255.255.255.0"</span>,<span class="hljs-string">"255.255.255.128"</span>,<span class="hljs-string">"255.255.255.192"</span>,<span class="hljs-string">"255.255.255.224"</span>,<span class="hljs-string">"255.255.255.240"</span>,<span class="hljs-string">"255.255.255.248"</span>,<span class="hljs-string">"255.255.255.252"</span>,<span class="hljs-string">"255.255.255.254"</span>,<span class="hljs-string">"255.255.255.255"</span>)
I believe them when they say that the lookup array is faster, but it leaves me wondering: what are they doing where performance matters that much?
I don’t actually think this ascends to the level of a WTF, but I do think the defensive comment is funny. Clearly, the original developer was having a time with people complaining about it.
Frank notes that while Perl has a reputation as a “write only language,” this particular set of scripts was actually quite easy to read and maintain. So yes, I guess we should stop being so #### about it.
Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!
Source: Read MoreÂ