Hello Listers.

 

Please I am a beginner.

I am making tentative steps to creating a script which will keep my
Notebook and Workstation at work in sync.

My first attempt is just to copy the files from the one to local.

Here is my script - it works, but I suspect there should be a better way
to do this "More Perl Correct" so to speak.

 

use warnings;

use strict;

use File::Copy;

 

while(defined(my $filename=glob("//xxxxxx/code/*.*"))) {

    if ($filename =~ m/(\w+)\.(\w+)/){

        my $main = $1;

        my $ext = $2;

    copy ("$filename", "c:/code/$main.$ext");

        }

}

 

I would especially appreciate pointers on the regex, is there a better
way to do this?

All pointers will be appreciated.

Many Thanks 

Denham

Reply via email to