http://www.perlmonks.org?node_id=977511

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

Hi there, I have several questions and I hope there are people with free time and desire to help me :) Please be patient because I wrote a line in Perl for the first time around 25/26 hours ago. I need to get to a .csv file in an ftp and then parse this file to find a specific numerical value and then I need to export it to sql but lets do it step by step :D So here is my code connecting to the ftp and trying to get the csv file. Can you please tell me if it is correct and if so how should I proceed? Open/Activate the file and try to "look" inside? I already have an idea how to find the value but NO IDEA how to do it in Perl :/ I hope you will bear with me. So here is the code (and thank you in advance):

#!/usr/bin/perl use strict; use IO::File; use File::Copy; use Net::FTP; sub main(){ my $ftp = Net::FTP->new("ftp://.....com"); $ftp->login('.....','.....'); + $ftp->binary(); $ftp->cwd('/a/b/c'); + my @ftpFiles =$ftp->ls(); + + my $i = 0; + + + while ($i < $#ftpFiles) { + + if($ftpFiles[$i] =~ m/andv/) + { $ftp->get($ftpFiles[$i +]); $myfile = $ftp; } $i++; } $ftp->quit();