Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^9: Parse .csv file from FTP using Perl

by muba (Priest)
on Jun 21, 2012 at 02:03 UTC ( #977534=note: print w/ replies, xml ) Need Help??


in reply to Re^8: Parse .csv file from FTP using Perl
in thread Parse .csv file from FTP using Perl

Oh yeah, it's definitely possible. Especially the second approach, because the ->getline_hr_all method allows you pretty much to limit the rows Text::CSV should look into. As for limitting things horizontally, that will prove to be a little more tricky, but it isn't impossible at all. I'll leave that up to you, though. You'll eventually end up with something that's a mix of both of my approaches, I think.

Just read the documentation for Text::CSV - it's pretty elaborate but written in a clear and understandable manner. FYI: I never used that module until just now, so working with Text::CSV was new to me, and I figured it out just by following the documentation.


Comment on Re^9: Parse .csv file from FTP using Perl
Download Code
Re^10: Parse .csv file from FTP using Perl
by Sherlock Perl (Novice) on Jun 21, 2012 at 02:20 UTC
    Thank you again, I am sure I will figure it out. I will make sure to post the final version so people with similar questions can benefit :)
Re^10: Parse .csv file from FTP using Perl
by Sherlock Perl (Novice) on Jun 21, 2012 at 14:31 UTC
    Hi I tried the code and the 2nd one is really preferable (I even understand it better than the first option). However, I have been trying to change so that for example I give the code the reference "Cat" and it returns me "Dog". What I mean is that it searches the 2nd row for the position not the first one and I cannot do it yet. I have been reading the Text::CSV_XS file but I find it a bit hard to grasp (I guess beucase I am still a little confused with the Perl way of working/thinking). I understand that I need to make the change in either getline() OR getline_hr_all but not sure where and what. I think all I have to do is make getline read from the 2nd line for example but I don't know how to do it. Any suggestions? Thanks in advance!

    EDIT: I figured it out. What i did was instead of using getline() I used getline_all and then all I have to is offset as much as I want. Thank you all, if I have more questions I will feel free to ask :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://977534]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (16)
As of 2014-07-24 16:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (162 votes), past polls