I am passing a reg expression from a subroutine which looks like:
$regex = "/(\S+) (\S+) (\S+) \[([^\]]*)\] (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) \"([^\"]*)\" \"([^\"]*)\"/";
I am then "matching" data against it with
$line =~ $regex;
The problem is that the matching does not work if the regex is passed in from the subroutine, but does work if I create the pattern explicitly in the routine:
$line =~ /(\S+) (\S+) ... etc. as above
Any ideas as to why?
Thanks
$regex = "/(\S+) (\S+) (\S+) \[([^\]]*)\] (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) \"([^\"]*)\" \"([^\"]*)\"/";
I am then "matching" data against it with
$line =~ $regex;
The problem is that the matching does not work if the regex is passed in from the subroutine, but does work if I create the pattern explicitly in the routine:
$line =~ /(\S+) (\S+) ... etc. as above
Any ideas as to why?
Thanks