On Tue, 2008-11-18 at 10:16 -0500, Chas. Owens wrote:
> Perl closes all file handles at the end of the program, so the only
> reasons to close file handles early are
> 1. the program doesn't end (it is a daemon)
> 2. you have a limited number of file handles in your environment (or
> you consume an
Hi Chas.,
Chas. Owens wrote:
On Tue, Nov 18, 2008 at 10:05, Raymond Wan <[EMAIL PROTECTED]> wrote:
Hi Lauri,
Good to hear -- if the file is small enough to be read in entirely, that is
what I would do. If you need to add in another loop to output a third file,
then you can just add it in
On Tue, Nov 18, 2008 at 10:05, Raymond Wan <[EMAIL PROTECTED]> wrote:
>
> Hi Lauri,
>
> Good to hear -- if the file is small enough to be read in entirely, that is
> what I would do. If you need to add in another loop to output a third file,
> then you can just add it in easily to make another pas
On Tue, Nov 18, 2008 at 09:53, Lauri Nikkinen <[EMAIL PROTECTED]> wrote:
snip
> #Read the data into an array
> my @data = <$fh>;
snip
This will only work so long as the file can be fit into memory, and
even then, if the file is large enough, it can have a noticeable
impact on system performance.
Hi Lauri,
Good to hear -- if the file is small enough to be read in entirely, that
is what I would do. If you need to add in another loop to output a
third file, then you can just add it in easily to make another pass.
One suggestion which makes no difference to your program and some people
Thanks to Ray, I ended up doing this in this kind of way:
-L
#==
#!/bin/perl
use warnings;
use strict;
use Text::CSV_XS;
use Tie::Handle::CSV;
my $fh = Tie::Handle::CSV->new(csv_parser => Text::CSV_XS->new({binary => 1}),
file
Hello,
I would like to parse a .csv file and write certain records into two
separate files. The program below writes the records easily into the
csvtmp.csv but the second file is only created with no records
written. I cannot see the problem here, the second file is produced
easily if the first lo
Hi Lauri,
Lauri Nikkinen wrote:
I would like to parse a .csv file and write certain records into two
separate files. The program below writes the records easily into the
csvtmp.csv but the second file is only created with no records
written. I cannot see the problem here, the second file is pr
Hello,
I would like to parse a .csv file and write certain records into two
separate files. The program below writes the records easily into the
csvtmp.csv but the second file is only created with no records
written. I cannot see the problem here, the second file is produced
easily if the first lo
On 9/19/07, Ruprecht Helms <[EMAIL PROTECTED]> wrote:
> Chas Owens wrote:
> > On 9/19/07, Ruprecht Helms <[EMAIL PROTECTED]> wrote:
> >> #!/usr/bin/perl
> >
> > First off, you should use the strict and warnings pragmas. So the
> > first two lines after the $! should be
> >
> > use strict;
> > use
Chas Owens wrote:
> On 9/19/07, Ruprecht Helms <[EMAIL PROTECTED]> wrote:
>> #!/usr/bin/perl
>
> First off, you should use the strict and warnings pragmas. So the
> first two lines after the $! should be
>
> use strict;
> use warnings;
...
I inserted the two commands and get now these errors.
On 9/19/07, Ruprecht Helms <[EMAIL PROTECTED]> wrote:
> #!/usr/bin/perl
First off, you should use the strict and warnings pragmas. So the
first two lines after the $! should be
use strict;
use warnings;
>
> open(CSV,"Kalkulation_Tauchsportportal.csv") || die "CSV-Datei nicht
> gefunden";
>
> $
Andrew Curry wrote:
> open(CSV,"Kalkulation_Tauchsportportal.csv") || die "CSV-Datei nicht
> gefunden\"; you have \ your "
Ok I corrected it, now I only have an syntax-error in line 25
(split-command). In addition i am told that the part is not terminated.
The actual code is:
#!/usr/bin/perl
@Datenfelder = split(/,,,$Felder);
Guessing this line.
Split (//,$string)
-Original Message-
From: Ruprecht Helms [mailto:[EMAIL PROTECTED]
Sent: 19 September 2007 15:00
To: Andrew Curry
Cc: Chas Owens; Jonathan Lang; beginners@perl.org
Subject: Re: parsing csv-file for inserting in
open(CSV,"Kalkulation_Tauchsportportal.csv") || die "CSV-Datei nicht
gefunden\"; you have \ your "
-Original Message-
From: Ruprecht Helms [mailto:[EMAIL PROTECTED]
Sent: 19 September 2007 10:40
To: Chas Owens
Cc: Jonathan Lang; beginners@perl.org
Subject:
Hi,
On running the script I get the following errors:
Scalar found where operator expected at ./csv_auslesen.pl line 29, near
"pint Auftrag "$Datenfelder"
(Might be a runaway multi-line "" string starting on line 3)
(Do you need to predeclare pint?)
Backslash found where operator expect
On Mon, 2007-09-17 at 13:34 -0700, Jonathan Lang wrote:
> Most of the replies have suggested using 'split( /\|/, $line )'.
> However, this ignores a potentially important aspect of common cvs
> file formats - well, important to me, anyway - which is the
> interaction between quotes, field delimite
On 9/17/07, Jonathan Lang <[EMAIL PROTECTED]> wrote:
snip
> Most of the replies have suggested using 'split( /\|/, $line )'.
> However, this ignores a potentially important aspect of common cvs
> file formats - well, important to me, anyway - which is the
> interaction between quotes, field delimit
Ruprecht Helms wrote:
> Hi,
>
> how can I parse a csv-file where the entries are seperated with | .
> The scripts later should put them into a mysql-database using dbi.
>
> Especially for me is interessting how to parse the content of the file
> and store them into different variables for later pr
On 9/16/07, Ruprecht Helms <[EMAIL PROTECTED]> wrote:
> Hi,
>
> how can I parse a csv-file where the entries are seperated with | .
> The scripts later should put them into a mysql-database using dbi.
>
> Especially for me is interessting how to parse the content of the file
> and store them into
Hi Ken,
>> how can I parse a csv-file where the entries are seperated with | .
>> The scripts later should put them into a mysql-database using dbi.
>
> if it just splitting:
>
> @data = split( /\|/, $line );
I see you are working with array. The using of the for each-loop must be
possible
On Sun, 2007-09-16 at 12:28 +0200, Ruprecht Helms wrote:
> Hi,
>
> how can I parse a csv-file where the entries are seperated with | .
> The scripts later should put them into a mysql-database using dbi.
if it just splitting:
@data = split( /\|/, $line );
If you forget the backslash it wil
Hi,
how can I parse a csv-file where the entries are seperated with | .
The scripts later should put them into a mysql-database using dbi.
Especially for me is interessting how to parse the content of the file
and store them into different variables for later processing.
A scriptexample would be
"Dave Sparrow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > Take a look at Text::CSV or Text::CSV_XS
> Ah, but here's the kicker...
> Most people who I will give this script to will be running Perl 5.6 and
WILL
> NOT have the ability to use any external modules, even those such
In article <[EMAIL PROTECTED]>, Dave Sparrow
wrote:
>> Take a look at Text::CSV or Text::CSV_XS
> Ah, but here's the kicker...
> Most people who I will give this script to will be running Perl 5.6 and
> WILL NOT have the ability to use any external modules, even those such as
> 'use strict' !
> T
> Take a look at Text::CSV or Text::CSV_XS
Ah, but here's the kicker...
Most people who I will give this script to will be running Perl 5.6 and WILL
NOT have the ability to use any external modules, even those such as 'use
strict' !
This is because they will be running a cut-down version of Perl th
On Tue, 24 Jun 2003, Sparrow, Dave wrote:
> I'm reading an Excel .csv file.
> Fields are separated by commas.
> If a field contains a comma, the whole field is double-quoted (Excel does
> this by default).
> An example of an input line is as follows:
>
> field1,field2,"field3a, field3b, field3c
you can get modules from cpan.perl.org
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
Confidential: This electronic message and all contents contain information
from Syntel, Inc. whi
Sparrow, Dave wrote:
I'm reading an Excel .csv file.
Fields are separated by commas.
If a field contains a comma, the whole field is double-quoted (Excel does
this by default).
An example of an input line is as follows:
field1,field2,"field3a, field3b, field3c",field4,"field5a, field5c",field6
I'm reading an Excel .csv file.
Fields are separated by commas.
If a field contains a comma, the whole field is double-quoted (Excel does
this by default).
An example of an input line is as follows:
field1,field2,"field3a, field3b, field3c",field4,"field5a, field5c",field6
I want to get each fiel
30 matches
Mail list logo