...
Some functions do not define what they return in list or scalar context. For instance, according to the {[perlfunc}} manpage, the sort()
function "sorts the LIST and returns the sorted list value. In scalar context, the behavior of 'sort()
' is undefined."
Noncompliant Code Example (sort()
)
...
Code Block | ||||
---|---|---|---|---|
| ||||
sub ret {
my $list = shift;
my @list = @{$list};
# ...
return sort @list;
}
my @list = ( "foo", "bar", "baz");
my $result = ret @list;
|
...
Code Block | ||||
---|---|---|---|---|
| ||||
sub ret {
my $list = shift;
my @list = @{$list};
# ...
return sort @list;
}
my @list = ( "foo", "bar", "baz");
my @result = ret @list;
|
...