in reply to Locate Unique column from a given set of column
Your loop would be more idiomatic written as
foreach my $line ( @lines ) { if ( my ( $pp, $pp1 ) = $line =~ /(.*?)\s+(\S+)/ ) { ... } } [download]
And yes, you are on the right track