1

I have a machine name which is bvvfred.scv.local or bvvbarney.scv.local. I only want it to match. I want to print only the second match, which is foo or bar. I want that match to be $1.

while(<>){
    if(m{bvv(fred|barney).scv.local (foo|bar)}){
        print "matches, $1\n";
    }
}

I know, I could print $2, but this is an example which is a part of several cases which I want to treat alike.

ericj
  • 2,138
  • 27
  • 44

0 Answers0