Perl line count if it matches a pattern

#!/usr/bin/perl
use Shell;
open THEFILE, "C:\galileo_integration.txt" || die "Couldnt open the file!";
@wholeThing = <THEFILE>;
close THEFILE;

foreach $line (@wholeThing){
if ($line =~ m/\\0$/){
@nextThing = $line;
if ($line =~ s/\\0/\\LATEST/g){
@otherThing = $line;
@grep_results = qx{cleartool diff -ser @nextThing @otherThing};
print "@grep_results\n";
$inserted = grep( "inserted" | "/^>$/" | "wc-l", @grep_results);
print "Number of lines Inserted, $inserted\n";
$deleted = grep( "deleted" | "/^>/" | "wc-l", @grep_results);
print "Number of lines Deleted, $deleted\n";
$changed = grep( "changed" | "/^>/" | "wc-l", @grep_results);
print "Number of lines Changed, $changed\n";
}
}
}

Output it gives is:
Number of lines Inserted, 100
Number of lines Deleted, 100
Number of lines Changed, 100

All gives me the same wordcount, but i want to grep line count based on matching Inserted, Deleted, Changed.

Output should be like:
Number of lines Inserted, 100
Number of lines Deleted, 50
Number of lines Changed, 220

I donot have any clue to match the patterns and retrieve the line count. Please help me. Thanks!!!

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

What happens at the first line ?
What is the output of that print command ?

tyler_durden