Thanks for the replies.
I replaced
my @contents = $archive_in->contents($_);
with
my $content_line = $archive_in->contents($_);
my @contents = split(/\n/, $content_line);
and it works like a charm.
John Wunderlich
Program Manager, Compliance
Directeur de Programme, Conformité
Tel/Fax: 514-908-3094
Ceridian
www.ceridian.ca
"$Bill Luebkert"
<[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED] 03/09/2005 03:12 PM |
|
[EMAIL PROTECTED] wrote:
>
> Hi;
>
> I'm using Archive::Zip to unzip a bunch of CSV files that I want to
> extract information from. The problem is that when I extact a file, and
> I try and read it into an array for line by line handling, the system
> doesn't see the line breaks. Has anyone run into this?
>
> Here's the relevant snippet:
>
> @members = $archive_in->members();
> foreach (@members) {
> my @contents = $archive_in->contents($_);
> foreach (@contents) {
> #line handling and parsing stuff goes here
> }
> }
>
> I would expect that the array @contents would be populated with one
> entry for each line in the CSV, but this is not the case. Typically the
> entire contents are one line, and a 0<zero> is the second line.
I haven't looked at the docs, but have you tried using split to handle it ?
my $contents = $archive_in->contents($_);
s/\000+$//; # just in case there is a null terminator
my @contents = split /\r*\n/, $contents;
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
John Wunderlich.vcf
Description: Binary data
_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs