Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Hughmoris
Apr 21, 2007
Let's go to the abyss!
Generally speaking, what is the current market like as a Perl developer?

I know the joke of "Perl is dead" etc... but for those of you who are comfortable with Perl, is there work to be had? Are Junior Developers in Perl still a thing these days?

Adbot
ADBOT LOVES YOU

Hughmoris
Apr 21, 2007
Let's go to the abyss!

Soricidus posted:

Much as I have a soft spot for Perl, I can’t imagine wanting a job working with it today. You’d either be stuck in hell maintaining the old Perl code so bad nobody dares port it, or you’d be working with the kind of person who thinks it’s a good idea to start major new projects in old unpopular languages, and neither of those sounds fun

Yeah, that's what I figured. I enjoy learning enough Perl for small personal scripts but I can imagine working on old enterprise software is not quite as fun.

Hughmoris
Apr 21, 2007
Let's go to the abyss!
Rookie perl question:

Given a string like '192.168.0.1:21,22,80,445,1432,30220' what would be a slick perl way to check if port 22 is in that string?

I can write it the naive way but I'm curious about a short-hand way to do it.

Hughmoris
Apr 21, 2007
Let's go to the abyss!

shoeberto posted:

iirc perl has regex support, might try that


biznatchio posted:

An example

To explain for a perl rookie, the check is:

pre:
if ($var =~ /(:|,)22(,|$)/) {
The =~ operator tests if a string matches a regex pattern. The regex is /(:|,)22(,|$)/ which tests if the string contains:

  • Either the character : or , -- followed by
  • The digits 22 -- followed by
  • Either the character , or the end of the string

This is what I was looking for, thanks!

I'm writing some simple utility scripts for work and, while Python would be easier for me, I just find Perl fun to write.

Hughmoris
Apr 21, 2007
Let's go to the abyss!

PhantomOfTheCopier posted:

Actually measuring minor performance differences of this scale is very difficult and depends on the distribution of inputs, however, there is a different way to structure the pattern:

code:
/:.*\b22\b/
This is "find a literal 22 as a word that is somewhere after a colon". The backslash-b is a "word boundary" that automatically handles all non-letters-digits-or-underscores as well as the beginning and ending boundaries of the string. Also as there's known to be the single colon separating the IP from the port list, this pattern might make more intuitive sense because it shows that everything to the left of the colon doesn't matter.

If you want additional validation, the full list of ports, etc., then it changes, but this is still twice as fast as fully splitting the string.

I was curious about performance of the different solutions. Anyone know best practices for benchmarking scripts in modern perl? I'm thinking I could generate a 1 GB file of IP addresses and ports, and benchmark the different solutions.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply