in reply to Locate Unique column from a given set of column

  1. The code doesn't compile
  2. You use variables that aren't declared or initialised
  3. Have you used Super Search? This question has been answered many times before

Your loop would be more idiomatic written as

foreach my $line ( @lines ) { if ( my ( $pp, $pp1 ) = $line =~ /(.*?)\s+(\S+)/ ) { ... } }

And yes, you are on the right track