my $pattern = "(g$)";
Here '$)' is perl special variable gives the effective group id of the process.
So finally $pattern gets '(g0'. It's not a parsed regular expression.
I assumed your try to match the letter 'g' at end of the line. So modify the below line in your code.
my $pattern = '(g$)';
Here the string assigned with in single quote. Now $pattern gets (g$). Its a parsed regular expression. So you able match your string end with 'g'.
For more information about single quoted string & double quoted string read the 'variable interpolation' concept.
k_manimuthu
Junior Poster in Training
93 posts since Jun 2009
Reputation Points: 55
Solved Threads: 24