in reply to Runtime Regexp Generation
Personally, I'd refrain from using one regex for all your querying -- I find it to hard to read.
Why not just use split() and then use regexes on the individual fields? A sample loop for processing line by line:
$user_param{source_addr} ||= '.'; # default value for param $user_param{dest_addr} ||= '.'; while (<DATA>) { my @data = split(/\s/, $_); next unless $data[2] =~ $user_param{source_addr}; next unless $data[3] =~ $user_param{dest_addr}; # ... print $_; }
|
|---|