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

From text to csv with Text::CSV_XS

by Perlbeginner1 (Scribe)
on Oct 05, 2012 at 10:04 UTC ( #997427=perlquestion: print w/replies, xml ) Need Help??
Perlbeginner1 has asked for the wisdom of the Perl Monks concerning the following question:

hello dear perl-fans

first of all - many thanks for the help. you helped me alot so far...

well i was running a script (see below) gave back the following;
linux-wyee:/home/martin/perl # perl Loostown Ledochowskastra�e 4 3382 Loosdorf Telefonnummer: 027 +54 6257 FAX-Nummer: 02754 6257-4 linux-wyee:/home/martin/perl # the script below gives back result like this one; Loostown Ledochowskastraße 3382 Loostown Telefonnummer: 0002754 6257 FAX-Nummer: 0002754 6257-4
see more results:
Marias Neustift Neustift 28 4443 Maria Neustift Telefonnummer: 007250/ +204 FAX-Nummer: 07250/204-4 E-Mail: prre.marianeustift@dioezese-linz. +at <bMarias Puchheim Gmundner Stra&#65533;e 1b 4800 Attnang-Puchheim Tele +fonnummer: 007674/62334 FAX-Nummer: 07674/62334-4 E-Mail: prre.mariap Marias Scharten Scharten 1 4612 Scharten Telefonnummer: 007272/5210 Marias Schmolln Maria Schmolln 2 5241 Maria Schmolln Telefonnummer: 00 +7743/2209-12 FAX-Nummer: 07743/2209-17 E-Mail: prre.mariaschmolln@dio Mattighofen R&#65533;merstra&#65533;e 12 5230 Mattighofen Telefonnumme +r: 007742/2273 0676/87765221 FAX-Nummer: 07742/2273-22 E-Mail: peipfa Mauerkirchens Pfarrhofstra&#65533;e 4 5270 Mauerkirchen Telefonnummer: + 007724/2262

note: the results should be stored in a csv formatted way...

for 1. therfore i did the changes: changed the $max_page_num to the max number and change $page to the starting number. this will only print the data to stdout (console)

now i am trying to modify it... :-)

well i have to put it to the CSV-values.

usually this can be done with use Text::CSV_XS (where the Class::CSV is based on). Note: A friend also suggested me using Text::CSV which will load up Text::CSV_XS or,

Well at the moment all the results will only print the data to stdout (console) im sure that i can modify it... :-)

i just installed the Text::CSV_XS took it from here:

how to combine the mechanize script with the one that takes care for the text-to-csv-transformation.

Replies are listed 'Best First'.
Re: From text to csv with Text::CSV_XS
by marto (Archbishop) on Oct 05, 2012 at 15:17 UTC

    Should you really be dumping these details here? This looks like Address and contact details. You're also asking the same question in other places here for example.

    "Well at the moment all the results will only print the data to stdout (console) im sure that i can modify it... :-)"

    Uh huh?

    "i just installed the Text::CSV_XS took it from here:"

    We've been over this before, it's even displayed each time you post: What shortcuts can I use for linking to other information?.

    So this is related to your previous posts regards scraping thousands of websites using WWW::Mechanize? As you've found out, simply installing a module isn't going to make the code you need to integrate the required functionality with your previous scripts. Try reading the documentation, writing some code. See my previous response.

Re: From text to csv with Text::CSV_XS
by Perlbeginner1 (Scribe) on Oct 05, 2012 at 10:27 UTC
    by the way

    there has to be some sanitizing as well..

    there has to be some iso 8859 sanitizing....

    use Text::CSV::Encoded; my $csv = Text::CSV::Encoded->new ({ encoding_in => "iso-8859-1", # the encoding comes into Perl encoding_out => "cp1252", # the encoding comes out of Perl

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://997427]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2018-07-20 14:46 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (435 votes). Check out past polls.