RSP has asked for the wisdom of the Perl Monks concerning the following question:

Hai everyone,

I want move a file from the working folder to another folder, but rest of the file process has to go in working folder. How to do this in perl, iam a perlkid.

Example

I want to compile a perl file in D:\abc\abc.plin that perl file i done a operation like moving a xml file to another folder which is in D: drive to validate the XML file after validation it has to automatically fetch the currrent working folder without any comeback path mention.

It might be a basic question, iam new to perl

Regards,

RSP

Replies are listed 'Best First'.
Re: Working Directory
by doom (Deacon) on Jul 19, 2007 at 05:57 UTC
    Your question isn't terribly clear, but if you need to move a file, I would use:
    use File::Copy qw( move ); move( $file_in_old_location, $new_location );

    If you need to change the working directory, you'd just use the chdir built-in command. You can save the current directory if you need to like so:

    use Cwd; my $pwd = cwd(); chdir( $somewhere_else ); # ... now you can do something over there chdir( $pwd ); # restores original location.

    If that's not what you needed to know, try asking again.

Re: Working Directory
by 13warrior (Acolyte) on Jul 19, 2007 at 18:22 UTC
    You can go through rename command in perldoc