in reply to Re^2: How to take only maximum directory name by using its digits using perl?
in thread How to take only maximum directory name by using its digits using perl?
Ok, you've corrected 2 problems with the regex. Now try this SSCCE and see if you can find another error. Remember you said 'No need to consider about the files inside those folders.'
poj#!/usr/bin/perl use strict; my $max; while (<DATA>) { if (/rev(\d+)/) { if ($1 > $max){ $max = $1; } } } print "max rev = $max\n"; __DATA__ `-- added |-- add.txt `-- added1 |--action | |-- action.txt | `-- rev1 | | `-- rev9999.html | `-- rev2 | `-- rev1.html `-- add.html
|
|---|