Hi !

My script don't understand file name with "interval",

help me with it problem !!!!

use Cwd;
$dir = cwd();

$vardas=$dir;

while($vardas=~/(.*\/)+(.*)/){

$vardas="$2_source";
}

$newfile = "$dir/$vardas.tex";

FILE: foreach $file (<@ARGV>) {
  if ($file eq $newfile) {next FILE};
 if (-e "$dir/$vardas.tex"){
   print "File exist\n";}
else{
print "Rename: "."$file\n";
 
  rename ($file, $newfile) || die "Can't rename.\n";}

}

Vika

I don't understand this script at all... you are doing a number of things that make little sense. For example:

while($vardas=~/(.*\/)+(.*)/){
     $vardas="$2_source";
}

Where is the variable $2_source coming from? You're also resetting the variable $vardas when inside your WHILE loop. That's never going to work.