Solution :
$string = "-9 55 48 -2 23 -76 4 14 -44";
while ($string =~ /-\d+/g) {
$count++;
}
print "There are $count negative numbers in the string";
$string = "-9 55 48 -2 23 -76 4 14 -44";
while ($string =~ /-\d+/g) {
$count++;
}
print "There are $count negative numbers in the string";
No comments:
Post a Comment