Sam Munzani wrote:
Team,

I am a totally newbee to perl scripting. I have learned enough to understand somebody's simple scripts and written some basic ones. Below is what I am trying to achieve.

I am writing a wrapper script to trigger when a syslog message arrives to syslog-ng. It fires up my parser.pl script by passing whole message as an argument. The message looks like this.

Jun 2 22:34:30 172.24.100.1 Jun 02 2009 22:34:33 home-pix : %PIX-6-302013: Built inbound TCP connection 3933236 for outside:172.23.1.1/50229 (172.23.1.1/50229) to inside:172.24.100.25/10000 (172.24.100.25/10000) (smunzani)

What I am trying to do is use RegEx to extract information from this. I want to capture IP address to a variable, hostname to another variable and anything after PIX-6-302013: as message variable. I was able to hack through creating the RegEx to match my requirements. However I don't know how to pass RegEx matches strings to value of another variable.

A regular expression *is* a string, it operates on strings and it returns strings. For example:

( $string1 ) = $string2 =~ /$string3/;

What do you mean by "RegEx matches strings"?



John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to