my ($result, @failedLineBits) = &helperFunctions::markFailedLines(@line_numbers,@data);
package helperFunctions;
use strict;
use warnings;
sub markFailedLines{
my (@line_numbers, @data) = @_;
SOME CODE IN HERE
return ($result,@out);
}
1;
sub markFailedLines{
my ($line_numbers, $data) = @_;
my @out;
if ($line_numbers) {
foreach my $ln ($line_numbers) {
$data[$ln+2] = "<font color=\"red\">$data[$ln+2]</font>";
push(@out, '<br><br>');
push @out, join('<br>', map{ join(': ', $_, $data[$_+2]) } $ln-3..$ln+3);
}
return ('FAILED',@out);
} else {
return ('PASSED',@out);
}
}
$line_numbers is a reference to an array. It has more than one value in it.It is a single reference.
if ($line_numbers) {will always be true
example:
@time = ("hour","minutes");
@date =("day","year");
Push (@time, @date);
Once you have the single array, pass the single array to the sub.