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