Perl: Regex match issues- how do I get my regex match in a list context?

Bes

Bes

Soldato
Joined
18 Oct 2002
Posts
7,318
Location
Melbourne
Hi,

I have a problem when using a regex match- I seem to be getting a boolen result (i.e. 1 to indicate a match) instead of the string I am trying to match lwhen using this code:

rrdtool ('update '.$config=~m/RRDDIR,(.*?),/. ' '.$RRD_NEXTROW);

Basically I have a config file loaded into a variable (dont ask why I am not using a hash- there is a good reason but I don't want to go into it here) and I am trying to pull out the values for use in my script by regex matching on the key (i.e. a line might look like RRDDIR,/home/test/test.rrd,).

However, like I said above, I get a 1 and not the actual value I want to pull out. I think this is because the context of the match is wrong (i.e. not a in a list context). How do I fix this please?

Thanks
 
Phew worked it out in the end (Was really simple :/)

Code:
my ($v2, $v3)=$config=~m/INTERVAL,(.*?),.*HEARTBEAT,(.*?),/;
 
Back
Top Bottom