I am trying to put xml data into mysql using perl
I have:
---
#!/usr/bin/perl -w
use strict;
use DBI;
use XML::Parser;
#create hash to hold values for expected column names
my %row = ("name" => undef, "category" => undef);
#connect to database
my $dsn = "DBI:mysql:database=tester
That would be one way. Alternatively, if you know you already have
List/MoreUtils.pm somewhere on your system, you could simply add its
location to @INC in the script itself (as, say, the first line). You
have to decide for yourself which approach is the more portable in your
situation...
Kim Hell
[EMAIL PROTECTED] schreef:
> :
>> perl -n00e'tr/\n/ /; print "$1\n" while s/^(.{0,69}\S)\s+//; print
>> "\n"'
>
> Since I'll use on both UNIX and DOS, can I put the $1 inside qq? as in
> ..print qq($1\n) while..
Yes you can. Or try it like this:
perl -wln00e'
tr/ \t\r\n/ /s;
print $1 while /
[EMAIL PROTECTED] schreef:
> I used to use sed a lot to take huge prose text
> reports and make tables from the information they had.
>
> I'm going to have to redo that sometime this Spring,
> so I'm wondering if learning perl is the way to do it faster.
It certainly is.
--
Affijn, Ruud
"Gew
[EMAIL PROTECTED] am Freitag, 9. Februar 2007 14:21:
> How do I get these two into one one liner?
>
> Obviously, semicolon, but I want to operate on the file
> all over again without using tmp files.
[1]
> cp /net/u/1/v/vjp2/weco.txt /net/u/1/v/vjp2/junk.tmp
[2]
> cat /net/u/1/v/vjp2/junk.tmp | p
[EMAIL PROTECTED] am Freitag, 9. Februar 2007 14:11:
> I just found this one online but not sure I understand it
>
> what are the .{ and s/ called so I can look them up?
>
> http://user.it.uu.se/~matkin/programming/PERL/perl-cookbook.shtml
>
>perl5 -p000e 'tr/ \t\n\r/ /;s/(.{50,7
On 2/9/07, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote:
Do i need to download List/MoreUtils.pm and copy into the
/usr/perl5/5.8.4/lib/sun4-solaris-64int path.
That's not a good way to proceed; why don't you read the
perlmodinstall manpage to learn how to install a module correctly?
Cheers!
Hi All,
I am getting following error while executing perl script
~/irf>perl lsco.pl
Can't locate List/MoreUtils.pm in @INC (@INC contains:
/usr/perl5/5.8.4/lib/sun4-solaris-64int /usr/perl5/5.8.4/lib
/usr/perl5/site_perl/5.8.4/sun4-solaris-64int /usr/perl5/site_perl/5.8.4
/usr/perl5/site_perl /
On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote:
I'm running this as a cron job 1 minute after midnight on Saturday
nights (Sunday morning) so as to cover all of Saturday back through the
previous Sunday. Does your suggestion mean I'd have to run it late
Sunday night in order for it to cover Saturd
How do I get these two into one one liner?
Obviously, semicolon, but I want to operate on the file
all over again without using tmp files.
cp /net/u/1/v/vjp2/weco.txt /net/u/1/v/vjp2/junk.tmp
cat /net/u/1/v/vjp2/junk.tmp | perl -n00e'tr/\t\r\n/ /; print "$1\n" while
s/^(.{0,36}\S)\s+//; print "
I just found this one online but not sure I understand it
what are the .{ and s/ called so I can look them up?
http://user.it.uu.se/~matkin/programming/PERL/perl-cookbook.shtml
perl5 -p000e 'tr/ \t\n\r/ /;s/(.{50,72})\s/$1\n/g;$_.="\n"x2'
>perl -n00e'tr/\n/ /; print "$1\n
>perl -n00e'tr/\n/ /; print "$1\n" while s/^(.{0,69}\S)\s+//; print "\n"'
Thanks! Far FAR better than anything I tried before.
However.. TR is killing paragraphs (double space is what I'm used to
because eMacs [and Greenview vEdit] stops reformatting when there is
an empty line) and includes carr
On 2/9/07, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote:
I have one array say @test = (1,2,3,2,5). Now if you observe 2 is
repeating in this array on second position and fourth position.
My requirement is that if such value is repeating twice then i just want
to remove one value and keep othe
On 2/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
After 20 minutes of web scouring can anyone tell if there is there
a difference between 'use warnings' and '-w'. Should I care?
Did you see the perllexwarn manpage anywhere in your scouring? Cheers!
--Tom Phoenix
Stonehenge Perl Trainin
>perl -n00e'tr/\n/ /; print "$1\n" while s/^(.{0,69}\S)\s+//; print "\n"'
Since I'll use on both UNIX and DOS, can I put the $1 inside qq?
as in
..print qq($1\n) while..
--
- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
I used to use sed a lot to take huge prose text
reports and make tables from the information they had.
I'm going to have to redo that sometime this Spring,
so I'm wondering if learning perl is the way to do it faster.
--
- = -
Vasos Panagiotopoulos, Columbi
I looked at CPAN. Back in the 1990s Walnut Creek had these HUGE code
repositories. I didn't use perl (I used sed back then) so I never
looked at them in detail. But I vaguely recall a Perl CDROM.
--
- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart,
It seems it was a DOS-UNIX cr/lf problem.
>
>Try without the -p switch and read about it in
>perldoc perlrun.
--
- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://ourworld.compuserve.com/homepages/vjp2/vasos.ht
Hi All,
I have one array say @test = (1,2,3,2,5). Now if you observe 2 is
repeating in this array on second position and fourth position.
My requirement is that if such value is repeating twice then i just want
to remove one value and keep other value.
So my array should look like @test = (1,
After 20 minutes of web scouring can anyone tell if there is there
a difference between 'use warnings' and '-w'. Should I care?
Thanks
--
Click to consolidate your debt and lower your monthly expenses
http://tagline.hushmail.com/fc/CAaCXv1QPxduBtcONj1YkWeIEBcQoisV/
--
To unsubscribe, e-mail
On Thu, 08 Feb 2007 16:11:15 +, vjp2 wrote:
> Does anyone have a simple one-liner that can take a file
> of text and reformat each paragraph to a new column width?
CPAN: Text::Wrap.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
--
To unsubscribe, e-mail: [EMAIL PR
If you're on a Unix system, just use the 'fold' or 'fmt' commands in a
pipe open.
Kim Helliwell
LSI Logic, Inc
408 433 8475
[EMAIL PROTECTED]
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 08, 2007 8:11 AM
To: beginners@perl.org
Subject: Se
I'm running this as a cron job 1 minute after midnight on Saturday
nights (Sunday morning) so as to cover all of Saturday back through the
previous Sunday. Does your suggestion mean I'd have to run it late
Sunday night in order for it to cover Saturday back to the previous
Sunday (since the timest
23 matches
Mail list logo