Ken Cole wrote:
> 
> Hi,

Hello,

> I have a directory in which there are files such as:
> 
> fred.1
> fred.2
> fred.3
> 
> The suffix increases and older files get deleted so there are always 3 fred.*
> files in the directory at any one time.
> 
> I need to get the name of the file with the highest suffix so I can go and do
> some other stuff with it.
> 
> I have tried lots of different things but to no significant outcome.
> 
> Any suggestions?


Here is one way to do it:

my $highest;

/\.(\d+)$/ and $1 > $highest and $highest = $1 for <directory/fred.*>;

print "Highest: directory/fred.$highest\n";



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to