use Net::FTP; $ftp = Net::FTP->new($host, Debug => 0) or die "Cannot connect to $host $@"; $ftp->login($user_name,$password) or die "Cannot login ", $ftp->message; $ftp->cwd($target_dir) or die "Cannot cd to $target_dir", $ftp->message; my @files = $ftp->ls('nok*'); for (@files) { $ftp->get($_) or die "couldn't get $_", $ftp->message; ... do something with the file ... } $ftp->quit;