in reply to Getting Data from Between Two Commas

If your document is not huge (say, less than a few 100 megabytes) you could just slurp it into a variable:

my $text = do {local $/; <$InFile>};

After that all you need to do is interpolate the string to be matched into your regex (remembering to use \Q and \E to quote meta characters), skip all non-comma (and probably full stop) characters until the first comma, then capture characters from the first comma to the next.

Have a read through perlretut and perlre for the details.


DWIM is Perl's answer to Gödel