in reply to Re^2: Am I doing Greedy Matching?
in thread Am I doing Greedy Matching?

OK, so change:

push @sourceDBHostsFromTnsEntry, $record =~ /HOST=(\S+-\S+)/g;

To:

push @sourceDBHostsFromTnsEntry, $record =~ /HOST=(\w+-\w+)/g;

Replies are listed 'Best First'.
Re^4: Am I doing Greedy Matching?
by vishi (Beadle) on Nov 10, 2011 at 12:33 UTC
    Ah Perfect! I think I had missed the /g and hence the array with only one record. What you suggested worked perfectly! Thanks!

    I tried out the other responses as well.. they work too. I liked the simplicity of the foreach method - easy to understand, but its kinda long to type. I keep very descriptive variable names so as to make the code (variables and their purpose) easy to understand by another person who;s looking at my code. In fact, it helps me too, if I have to revisit my code after a year or two.

    Thanks all for your suggestions! Truly and highly appreciate your contributions :-)