5 ms·
>There was no such thing as just writing f(a,b) to call a function. You had to use something called "$@" or whatever Just so it's clear, you do call a function
by tyingq 5y ago
>There was no such thing as just writing f(a,b) to call a function. You had to use something called "$@" or whatever
Just so it's clear, you do call a function in that way... some_function($a,$b).
It's how the function gets a hold of those arguments that you're talking about..the args are in an array called @_, like:
sub some_function {
($first_arg,$second_arg)=@_;
}
And, like most things in Perl, there's lots of different ways to deal with it. Using shift(), or passing args as a hash, etc.
- civilized 5y agoThanks for clarifying, I edited accordingly.
- DonHopkins 5y agoHaving a lot of different bad ways of dealing with something is not an excuse for not having a single good way of dealing with something, which is kind of the point about why Perl has failed as a programming language.
- tyingq 5y agoI wasn't suggesting it was a good thing.