If I understand your question correctly, then the problem is that your regex does not match. /rev_(\d)+/ has an _ where your sample input does not, and the + quantifier should be on the character it is supposed to quantify, \d, not the capture group. If I change the regex to /rev(\d+)/, your code works for me, meaning that when the loop ends, $max_id holds the highest directory number (2, in both cases).
Note: I am taking your sample input literally, meaning that I am assuming the two sample inputs you showed are exactly what your "log file" looks like. If this is not the case, please read and understand this page: SSCCE.
In reply to Re: How to take only maximum directory name by using its digits using perl?
by haukex
in thread How to take only maximum directory name by using its digits using perl?
by finddata
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |