in reply to perl extraction from a file

How abt extracting it like this,
$JobId = $1 if $string =~ m{<job_id>(.*?)</job_id>};
Thanks

Replies are listed 'Best First'.
Re^2: perl extraction from a file
by blazar (Canon) on Nov 08, 2005 at 10:30 UTC

    Well, if you already knew, why did you ask in the first place? Whatever, the answer is that it may work in some simple case, but due to the many subtleties involved, it is deemed not to be applicable to more complex ones. So it all depends on your actual data and on how much you can rely on them.

    Incidentally you may also use /g and the return value of m/// in list context although I admit that here, due to the fact that you're assigning to a single scalar, the "goatse operator" =()= would be needed and it wouldn't make such a cleaner solution.