Vote count: 0
I wrote this script in perl, where I extract the pass count and failure count and print it as 1 and -1. Below is what I have tried and it works fairly well but I want to know if there is a way that I can improvise the code?
my $pc = 10;
my $fc = 5;
my $v = "";
my $c = 0;
while ($c < $pc){
if ($c > 0) {
$v .= ",";
}
$c++;
$v .= "1";
}
$c=0;
while ($c < $fc){
if ($c > 0) {
$v .= ",";
}
$c++;
$v .= "-1";
}
print $v;
print "\n";
output:1,1,1,1,1,1,1,1,1,1-1,-1,-1,-1,-1
I would like to have the output printed as:
output:1,1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1
Appreciate any ideas or suggestions.
asked 52 secs ago
program to print pass count as 1 and failure count as -1
Aucun commentaire:
Enregistrer un commentaire