3 ms·
I agree Perl is great for everything listed except: sub function_name { my ($var1,$var2..) = @_; } I know why methods are like that, but
by caw 15y ago
I agree Perl is great for everything listed except:
sub function_name
{
my ($var1,$var2..) = @_;
}
I know why methods are like that, but it doesn't make me any less unhappy to have to read a function in order to figure out what types and what order I need to pass values to a function.
There's a few Perl programmers at work who end up using just a bunch of global variables instead of doing pass by reference or returning values from subs.
sub do_something {
# modify %my_global_hash
}
It's just strange working with Perl after working in more OO languages. But, like you said, Perl adapts to your style. I want it more like other languages I've written in, whereas the people I work with don't.
Getopts::Long is amazing for parsing command line, and I don't know how I would work without being able to do the inline if and unless statements.
- gatlin 15y agohttps://metacpan.org/module/Function::Parameters https://metacpan.org/module/Function::Parameters There are other modules out there like this, including one that bakes it into Moose methods. This also highlights a cool Perl feature: hack able syntax.
- sciurus 15y agoThere are lots of other modules https://metacpan.org/module/Method::Signatures https://metacpan.org/module/Method::Signatures https://metacpan.org/module/MooseX::Method::Signatures https://metacpan.org/module/MooseX::Method::Signatures https://metacpan.org/module/Method::Signatures::Simple https://metacpan.org/module/Method::Signatures::Simple and many more. In this case, there might be too many ways to do it.
- kamaal 15y agoI don't know what might have Larry thought while designing this. But I can imagine only of one thing. While writing Perl one liners it might become difficult to fit in the parameters in the usual C based function implementation syntax, in such cases this might turn out useful. Let us not forget sysadmins use Perl a lot on the command line.