in reply to Variable assignments flat file

If you are looking for certain fields in the line(s) of text, this code will do the job.
use strict; use warnings; my @lookfor = qw|PROTOCOL HOST PORT SID GLOBAL_NAME|; my $search_regex = "(" . join( "|", @lookfor) . ")"; my %item; my $inputstr = <DATA>; chomp $inputstr; while ($inputstr =~/$search_regex\s+(\S+)/g){ $item{$1} = $2; } print qq|$_ = $item{$_}\n| for sort keys %item; __DATA__ orclNetDescString DESCRIPTION ADDRESS PROTOCOL TCP HOST doa.sdasd.sdf. +sdf. PORT 1521 CONNECT_DATA SID devdb GLOBAL_NAME devdb.discoveringmo +rclSid devdb
OUTPUT:
GLOBAL_NAME = devdb.discoveringmorclSid HOST = doa.sdasd.sdf.sdf. PORT = 1521 PROTOCOL = TCP SID = devdb

        “The sources of quotes found on the internet are not always reliable.” — Abraham Lincoln.3; cf.