Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy, move, dowload with perl

Status
Not open for further replies.

eve25

Programmer
Feb 9, 2004
32
US
Hi all,
I am currently translating code from Matlab to Perl and both language are new for me. I have to copy, move, download files, send mails for a great part of the program. The code in matlab uses UNIX command to do that and for the moment I have done it this way too, like
my $copy=`cp $oldFile $newFile` and it is working well but I am wondering if it would not be more effective using perl built-in functions... I need advise so if someone knows about that I would be really glad to hear from you...

Thanks a lot and have a wonderful day!
Eve
 
File::Copy has copy routines and would be worth a look. It's been a standard module for some time, so you should already have it. Check cpan or perldoc for is documentation on usage, but it's as straighforward as you might think. There's a move function in the module, too, but you can also use the Perl builtin rename() function.

As to downloading files, I suggest something in the LWP suite. Unless you need to keep track of cookies or some such, LWP::Simple does plenty well for me at least 90% the time.

Best of luck. Any questions, just ask.

________________________________________
Andrew - Perl Monkey
 
Thanks a lot Andrew! See U maybe another time (I won't be done with that for a long time...)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top