file name with "interval"

Reply

Join Date: Sep 2008
Posts: 8
Reputation: viktorijakup is an unknown quantity at this point 
Solved Threads: 0
viktorijakup viktorijakup is offline Offline
Newbie Poster

file name with "interval"

 
0
  #1
Nov 30th, 2009
Hi !

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

help me with it problem !!!!


  1. use Cwd;
  2. $dir = cwd();
  3.  
  4. $vardas=$dir;
  5.  
  6. while($vardas=~/(.*\/)+(.*)/){
  7.  
  8. $vardas="$2_source";
  9. }
  10.  
  11. $newfile = "$dir/$vardas.tex";
  12.  
  13. FILE: foreach $file (<@ARGV>) {
  14. if ($file eq $newfile) {next FILE};
  15. if (-e "$dir/$vardas.tex"){
  16. print "File exist\n";}
  17. else{
  18. print "Rename: "."$file\n";
  19.  
  20. rename ($file, $newfile) || die "Can't rename.\n";}
  21.  
  22. }

Vika
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 58
Reputation: mitchems is an unknown quantity at this point 
Solved Threads: 2
mitchems's Avatar
mitchems mitchems is offline Offline
Junior Poster in Training
 
0
  #2
Dec 8th, 2009
I don't understand this script at all... you are doing a number of things that make little sense. For example:

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

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.
And don't tell me there isn't one bit of difference between null and space, because that's exactly how much difference there is.

Larry Wall
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Perl Forum


Views: 760 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Perl
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC