Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 09-19-2002, 10:50 AM   #1
Member (7 bit)
 
Join Date: Mar 2002
Posts: 79
Boom Perl rename won't cooperate!

I have tried all combinations of quotes and parens in the 'rename ("$file.dat", "$file") || die "can't rename file.dat";' statement. Of course, I started with no quotes or parens at first. The rename to .orig works, the rename to $file does nothing (p.s. don't get the die message either?). Any idea what can be wrong here??

Print of $file and $file.dat From my logfile...
9/18/2002 14:32:43 Updating School Code for Spara9002.txt:
9/18/2002 14:32:43 in = Spara9002.txt
9/18/2002 14:32:43 out = Spara9002.txt.dat

}

sub doit {
my $file;
my $fdir;

$file = @_[0];
$fdir = "D:\\Inetpub\\ftproot\\datafeeds\\Cardtrans\0000All"

logit "Updating School Code for $file:";

open(IN,$file) || die "cannot open $file for READ: $!";
open(OUT,">$file.dat") || die "cannot WRITE $file: $!";
while () { # read 1 line from $file into $_
$_ = substr($_, 134, 5) . substr($_, 5);
print OUT $_; # print current line to $file.dat;

}
close IN;
close OUT;
chmod (0666,$file.dat);
rename ("$file.dat", "$file") || die "can't rename file.dat";
rename $file, "$file.orig";
logit "in = $file";
logit "out = $file.dat";

}


{
Razz is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:23 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2