in reply to Am I doing Greedy Matching?
You say the data looks like machine1-basement.xyz.com but the pattern /[\w]*\-[\w]*/ (or more simply /\w*-\w*/) will only match the string machine1-basement, not the whole domain name.
You probably need something like this:
open SOURCETNS, '<', "/home/$User/Work/PROJ/$sourceTnsFileName" or die + "Cannot open '/home/$User/Work/PROJ/$sourceTnsFileName' because: $!" +; while ( my $record = <SOURCETNS> ) { push @sourceDBHostsFromTnsEntry, $record =~ /HOST=(\S+-\S+)/g; push @sourceDBPortsFromTnsEntry, $record =~ /PORT=(\d+)/g; } close SOURCETNS;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Am I doing Greedy Matching?
by vishi (Beadle) on Nov 10, 2011 at 11:39 UTC | |
by jwkrahn (Abbot) on Nov 10, 2011 at 11:43 UTC | |
by vishi (Beadle) on Nov 10, 2011 at 12:33 UTC |