I'm quite new to perl and I can't seem to find any information on how one would know if a subroutine takes a parameter.
In other languages (e.g python, java, etc), it is very clear, a method/function usually looks like this:
def my_func(arg1, arg2):
# do something
But in perl, it's simply:
sub my_func {
my params = @_;
# do something
}
But I've seen examples where my params = @_ isn't even included, but the subroutine is called and passed an argument.
e.g
sub my_func {
my $self = shift;
my $fieldstr = 'tbl'.$self->db_func.'*,';
my $sql = "SELECT $fieldstr FROM tbl".$self->db_func.'WHERE'.$self->...;
my $sth = $self->other_func->my_func($sql) or return undef;
}
So I was wondering if there is some sort of guideline to know if a subroutine takes a parameter(s)?