I've used Perl off and on throughout my career, even working at one job that was pretty much exclusively Perl. I've also used Java and C/C++. I've done a lot of work with embedded systems where C was the order of the day. But back to Perl. I always thought one of the best things about Perl was CPAN. I could nearly always find a module that would accomplish a specific task I needed and then I was just left to write th…
Not Your Grandfather’s Perl
101–110 of 257 posts
Re: Not Your Grandfather’s Perl
#102Earlier quoted context omitted.
> What I do appreciate that's missing from many other languages and systems is the extreme committment to backwards compatibility. The knowledge that the next minor release won't break existing scripts is underrated, IMO. I don't write much Perl these days and haven't for some time, but it's still what I might reach for if I were tasked with writing something suitable for a scripting language that had to run with ~0…
Perl needs backwards compatibility given the `write once, read never` nature of the syntax. Imagine trying to upgrade this to some new syntax... https://github.com/schwern/AAAAAAA
https://metacpan.org/pod/Acme::Bleach>
Re: Not Your Grandfather’s Perl
#103 use Modern::Perl;
and you get the lot of those features.Re: Not Your Grandfather’s Perl
#104Perl receives such an unnecessary amount of hate
Re: Not Your Grandfather’s Perl
#105"Bare bones" seems to be a good thing for Perl. I use Strawberry Perl on Windows and it is orders of magnitude faster than Powershell for processing large files of text strings using regular expressions. I hope the addition of a "new object-oriented programming framework" won't take away the "bare-bones" speed of the current release.
Perl's bindings for Win32 and OLE are amazing.
Re: Not Your Grandfather’s Perl
#106Re: Not Your Grandfather’s Perl
#107Earlier quoted context omitted.
I’ve had very limited contact with Perl, but for scripting purposes it does seem like the best option, so I intend to sit down to it and learn it better. It looks like a great next step after sed and awk (perl -pe). I love the ability to write terse scripts, reasonable speed for a scripting language and, as you said, backwards-compatibility (such a stark contrast compared to Python).
I would argue that ruby as almost all the strengths of perl and conciseness with more coherency if you want a perl-like fluidity and terseness. I personally like python for anything that becomes more than a 100 lines of bash.
Disclosure: I'm the author.
Re: Not Your Grandfather’s Perl
#108Earlier quoted context omitted.
Signatures were added in 5.020, and [edited:] were considered experimental until 5.036.
are Perl function signatures the PHP/Python equivalent of type hints?
sub myFunction {
my ($self, $arg1, $arg2) = @_;
...
}
Or, in older code, you might even see this: sub myFunction {
my $self = shift; # implicitly get the first value from @_
my $arg1 = shift;
my $arg2 = shift;
...
}
Notably, this didn't even check the number of arguments you passed. If you passed too many or too few arguments to a function which worked this way, the extra arguments would silently be ignored, or missing arguments would silently show up as undef.Function signatures turn this into something that'll look much more familiar to users of other languages:
sub myFunction ($self, $arg1, $arg2) {
...
}
which includes checks to make sure that all the expected arguments (and no more) were passed.Re: Not Your Grandfather’s Perl
#109Re: Not Your Grandfather’s Perl
#110Perl receives such an unnecessary amount of hate
Those who've had to maintain someone else's perl tend to find that the hate is, if not strictly necessary, very much warranted.
Every new Dev says the previous code is shite. Odd that the plumber and electrician do it too.
It's as if nobody can produce good work except for $ME at $NOW