re: Why do people like Perl? VIEW POST

VIEW FULL DISCUSSION
use feature qw{ signatures } ;
no warnings qw{ experimental::signatures } ;

sub shorten ( $string ) {
    $string =~ s{(https?://\S+)}{ makeashorterlink( $1 ) }gmixe ;
    return $string ;
    }

But really, once you internalize it, is there really much difference between that and this?

sub shorten {
    my $string = shift @_ ;
    $string =~ s{(https?://\S+)}{ makeashorterlink( $1 ) }gmixe ;
    return $string ;
    }

I recall that in C, you can have it so that you have separate functions for shorten(), shorten(string), shorten(integer), shorten(string,string,string), etc., but that's striking me as a huge violation of DRY. I'm willing to be schooled on the point, though.

There is much to like about Joel Berger's response. I know Joel, and I like Joel. But then, I know Perl and I like Perl. B)

There's also something to Lorenzo Pasqualis' answer.

My coding journey started with C and C++, but as a student employee working with web, it struck me that writing string manipulation code in C was a nightmare, and when I started learning Perl, I saw it as godsend for the tasks at hand.

Beyond that, from the beginning, it fit my brain. I could write pseudocode for a problem and Perl could usually run it. And since then, for fun and for work, I have spent years writing Perl that fits my brain and learning things that make my brain fit Perl.

(I really think that the idea most people have of Perl is based on Matt's Script Archive. With the introduction of Modern Perl, Higher-Order Perl, perltidy and Perl::Critic, the standard for Perl has gotten better since the 1990s, but even by the standards of 1990s, Matt's Script Archive had really bad Perl code.)

With Perl, you get CPAN, which is an incredible source of pre-invented wheel, with the option to use or ignore as necessary. For example, there are quite a number of ways to get CLI arguments in Perl, but it's rare that Getopt::Long doesn't do everything I need.

To contrast, there exists Text::Levenshtein to tell the distance between add and zdd (useful to suggest changes if you accidentally type git zdd README.md) but an independent implementation exists in perlbrew, where they assume you don't have the module and you don't have admin privileges.

I can't say there's nothing I'd want to do that I can't do in Perl, but where I can't, it's either far outside the niche where Perl lives -- Windows is doable, mostly, I think Android is theoretically possible and inside the browser would be weird -- or I just haven't learned enough to make it work. All my interaction with the FitBit API had been with Python, and once they moved to OAuth2, I haven't been able to make anything work.

code of conduct - report abuse