Brian Milbrandt wrote: > I am trying to convert a unix script to perl. The script takes 2 > command line arguments, source and target. I am unable to get the > file copy and rename function working properly. Here is what I have > that is not working properly. > > $target is the target directory variable > $source is the source directory variable > > opendir DH, "/$target"; > foreach $file (readdir DH) > { printf " the file name is %s\n", $file; > next unless $file =~ \/.abc$/ and !-z $name; Since you did not provide what really happens, I am assuming that you are not getting by ! -z $name. You have not done a chdir, so to get the actual file you will need to concatenate "/$target/" . $name for the test.
Wags ;) > my $newfile = /$target//$file; > $newfile =~ s/\.abc$/.xyz/; > $filecount += 1; > } ******************************************************* This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. ******************************************************* -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>