Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Concatenation

Expand Messages
  • Robert Binkley
    #!/usr/bin/perl     use strict;     use warnings;     use Text::CSV;     my $file = prospects.csv ;     my $csv = Text::CSV- new();     open
    Message 1 of 5 , May 18, 2010
          use strict;
          use warnings;
          use Text::CSV;

          my $file = 'prospects.csv';

          my $csv = Text::CSV->new();

          open (CSV, "<", $file) or die $!;

          while (<CSV>) {
              if ($csv->parse($_)) {
                  my @columns = $csv->fields();
                  print "@columns\n";
              } else {
                  my $err = $csv->error_input;
                  print "Failed to parse line: $err";
          close CSV;

      >From: "wkirk195@..." <wkirk195@...>
      >To: perl-beginner@yahoogroups.com
      >Sent: Tue, May 18, 2010 11:42:31 AM
      >Subject: Re: [PBML] Concatenation

      >I have downloaded TEXT::CSV. Now how is it used? I want to input a text file and have a CSV output. Also I am not sure I have installed on my version of Perl correctly. I unzipped the file and then put CSV.PM in the Text directory, but I'm not sure if that is correct.
      >I am using Strawberry Perl
      >----- Original Message -----
      >From: merlyn@...
      >To: "billkirk23" <billkirk23@...>
      >Cc: perl-beginner@yahoogroups.com
      >Sent: Monday, May 17, 2010 2:56:17 PM GMT -05:00 US/Canada Eastern
      >Subject: Re: [PBML] Concatenation
      >>>>>> "billkirk23" == billkirk23 < billkirk23@... > writes:
      >billkirk23> I am reading in an input file. The file is a column of
      >billkirk23> names and addresses. I then want to concatenate the name
      >billkirk23> and address on one line with quotes and separate the name,
      >billkirk23> address, and zip by a comma. Basically creating a .CSV file
      >billkirk23> that will be imported to Excel for making labels.
      >Ahh, then use any of the CSV modules, such as Text::CSV. Then you don't
      >need to reinvent an often over-reinvented wheel.
      >Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
      >< merlyn@... > <URL: http://www.stonehenge.com/merlyn/ >
      >Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
      >See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
      >[Non-text portions of this message have been removed]

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.