On Thu, Jan 17, 2002 at 06:16:08PM +0000, Frank goofed: > my $num= ($name=~/\((\d+\)/)?$1:1; > $num++ while(-e "$name($num).$ext"); ---end quoted text---
Ah, forgot to paste the tested version back in my bad. #!/usr/bin/perl use strict; my($name,$ext)=('test','foo'); my $num= $name=~/\((d+)\)/?$1:1; # get number or make it 1. $num++ while -e "$name($num).$ext"; # while the file exists incr num open O,">$name($num).$ext"; # Make shiny new file. -- Frank Booth - Consultant Parasol Solutions Limited. (www.parasolsolutions.com) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]