Re: Another flat-file insert question
From: Leegold (leegold_at_fastmail.fm)
Date: 05/19/04
- Next message: Kevin Chen Ctr: "perl.dbi.users DBI.pm issue on windows uninitialized values"
- Previous message: v796: "Re: Perl pulling data from SQL Server"
- In reply to: Jeff Zucker: "Re: DBI path help - newbie ques."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: dbi-users@perl.org Date: Wed, 19 May 2004 00:17:11 -0400
> ....snip..eg.
> I get,
> f1|f2|f3f1|f2|f3
> <eof>
> vs. what I'd expect
> f1|f2|f3
> f1|f2|f3
> <eof>
> Is the fix just to make sure the last
> record has one "/n"...?
Kind of a problem I had with a flat-file db
when I made an insert. For what it's worth I did
some code that seems to be ok,
....
use Tie::File;
my $file='C:\threesharp\datatest.threesharp';
tie my @array, 'Tie::File', $file;
# remove blanks, other stuff from file end
while (1) {
if ($array[$#array] =~ m/^\s*$/) { pop (@array); }
else { last; }
}
# Tie::File's default behavior ensures one "/n" at record end
$array[$#array] = $array[$#array];
untie @array;
-- http://www.fastmail.fm - Choose from over 50 domains or use your own
- Next message: Kevin Chen Ctr: "perl.dbi.users DBI.pm issue on windows uninitialized values"
- Previous message: v796: "Re: Perl pulling data from SQL Server"
- In reply to: Jeff Zucker: "Re: DBI path help - newbie ques."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|