oysters2000
Programmer
I don’t understand how they get their answer as the code is not that clear.
Could some one could explain line by line how they get their answer, I would really appreciate it.
sub returnValues {
my($target, @values) = @_;
my(@results);
foreach(@values) {
$_ > $target ? push(@results, “$_\n”) : “”;
}
return @results;
}
using this subroutine, what is the output of the following perl statements?
@myNumList = (33, 35, 67, 11, 78, 99, 23, 55);
print returnValues(50, @myNumList);
Could some one could explain line by line how they get their answer, I would really appreciate it.
sub returnValues {
my($target, @values) = @_;
my(@results);
foreach(@values) {
$_ > $target ? push(@results, “$_\n”) : “”;
}
return @results;
}
using this subroutine, what is the output of the following perl statements?
@myNumList = (33, 35, 67, 11, 78, 99, 23, 55);
print returnValues(50, @myNumList);