-----Original Message-----
From: Offer Kaye [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 28, 2005 12:17 PM
To: Perl Beginners
Subject: Re: Problems matching or parsing with delimiters in text

On Mon, 28 Mar 2005 11:13:05 -0500, KEVIN ZEMBOWER wrote:
> I'm trying to read in text lines from a file that look like this:
[...snip...]

As others have said, you really should use a module. For completness, here's
a solution using Text::CSV::Simple ("datafile" holds the data you gave in
the question):

use Text::CSV::Simple;
my $parser = Text::CSV::Simple->new;
my @data = $parser->read_file("datafile"); for my $aref (@data) {
   my ($partno, $language, $title, $cost, $available) = @$aref;
   print "PN=$partno, L=$language, T=$title, C=$cost, A=$available\n"; }

####

I just tried the following (Win XP, AS Perl 5.6.1):-

C:\...PERL Documents>ppm install Text::CSV::Simple

And got (slightly re-formatted):-

 Installing package 'Text-CSV-Simple'...
 Error installing package 'Text-CSV-Simple':
 Could not locate a PPD file for package
 Text-CSV-Simple

Only a short while before I had no trouble with "ppm install
HTML::CalendarMonthSimple".  How do I fix the above and get the CSV module?

Rgds, GStC.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to