#!/usr/bin/perl use strict; use Net::FTP; my $host="ftp.ncbi.nih.gov"; my $user ="anonymous"; my $rmtdir = "/pub"; my $pass = "me\@here.there"; # login my $ftp = Net::FTP->new("$host", Debug => 0); $ftp->login($user,$pass); # change to a subdirectory (could have included in $rmtdir) my $rmt_subdir = "/HomoloGene/current"; $ftp->cwd($rmt_subdir); # change to binary transmission (vs ASCII) $ftp->binary; # download file to local subdirectory my $local_subdir = "download"; if (! -e $local_subdir) { # if local subdir doesn't exist, create it mkdir("$local_subdir"); } $ftp->get("homologene.xml.gz","$local_subdir/homologene.xml.gz"); # logout $ftp->quit(); exit(0);