Re: type comparison in perl

2007-08-31 Thread Chas Owens
On 8/31/07, Ken Foskey <[EMAIL PROTECTED]> wrote: > On Fri, 2007-08-31 at 15:08 -0400, Hunter Barrington wrote: > > is there a type() function in perl? i need to be able to test the > > contents of an array and > > if (type($value)=='string' or type($value)=='int') {print "i win";} > > if( $value =

Re: Re: create a uft8 file

2007-08-31 Thread kenpeng
- original Nachricht Betreff: Re: create a uft8 file Gesendet: Fr 31 Aug 2007 21:08:08 CEST Von: "Chas Owens"<[EMAIL PROTECTED]> > On 8/31/07, Digger <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I want to create an utf8 file and write some content (like html codes) to > it. > > How

Re: Parsing qmail-qread data

2007-08-31 Thread John W. Krahn
Ken Foskey wrote: On Fri, 2007-08-31 at 18:05 -0700, Chris E. Rempola wrote: I'm trying to parse qmail-qread data, but don't know how to find the number of occurrences after a particular string. Here is the data: +++ Beginning of data + 28 Aug 2

Re: create a uft8 file

2007-08-31 Thread Gunnar Hjalmarsson
Digger wrote: Chas Owens wrote: On 8/31/07, Digger <[EMAIL PROTECTED]> wrote: I want to create an utf8 file and write some content (like html codes) to it. How to do it? Modern Perl handles utf8 natively. You can do things like: #!/usr/bin/perl use strict; use warnings; open my $fh, ">",

Re: Parsing qmail-qread data

2007-08-31 Thread John W. Krahn
Chris E. Rempola wrote: I'm trying to parse qmail-qread data, but don't know how to find the number of occurrences after a particular string. Here is the data: +++ Beginning of data + 28 Aug 2007 17:00:47 GMT #8807850 41428 <[EMAIL PROTECTED]>

Re: create a uft8 file

2007-08-31 Thread Chas Owens
On 8/31/07, Digger <[EMAIL PROTECTED]> wrote: snip > Does this mean I need to convert the string to utf8 at first then print it to > $fh? > Is there a way that I don't need to convert the string by hand?I mean when > printing,perl convert it > to utf8 automaticly. > Thank again. snip It is my, p

Re: create a uft8 file

2007-08-31 Thread Digger
> -Original Message- > From: [EMAIL PROTECTED] > Sent: Fri, 31 Aug 2007 15:07:21 -0400 > To: [EMAIL PROTECTED] > Subject: Re: create a uft8 file > > On 8/31/07, Digger <[EMAIL PROTECTED]> wrote: >> Hello, >> >> I want to create an utf8 file and write some content (like html codes) >> to

Re: Parsing qmail-qread data

2007-08-31 Thread Ken Foskey
On Fri, 2007-08-31 at 18:05 -0700, Chris E. Rempola wrote: > I'm trying to parse qmail-qread data, but don't know how to find the > number of occurrences after a particular string. Here is the data: > > +++ Beginning of data + > 28 Aug 2007 17:00:4

Re: type comparison in perl

2007-08-31 Thread Ken Foskey
On Fri, 2007-08-31 at 15:08 -0400, Hunter Barrington wrote: > is there a type() function in perl? i need to be able to test the > contents of an array and > if (type($value)=='string' or type($value)=='int') {print "i win";} if( $value =~ m/^\d+$/ ) { print "I am a number\n"; } -- Ken Foskey

Parsing qmail-qread data

2007-08-31 Thread Chris E. Rempola
I'm trying to parse qmail-qread data, but don't know how to find the number of occurrences after a particular string. Here is the data: +++ Beginning of data + 28 Aug 2007 17:00:47 GMT #8807850 41428 <[EMAIL PROTECTED]> done remote [EMAIL P

Re: type comparison in perl

2007-08-31 Thread Tom Phoenix
On 8/31/07, Hunter Barrington <[EMAIL PROTECTED]> wrote: > is there a type() function in perl? i need to be able to test the > contents of an array and > if (type($value)=='string' or type($value)=='int') {print "i win";} You probably meant to use the 'eq' (string equality) comparison operator in

Re: import CSV files in MYSQL

2007-08-31 Thread jm
if you have access to the mysql client and server you don't need any modules, just use the "load data" sql command with all the requisite parameters. if you need to make a perl script for it, just use the standard dbd (or dbi, i forget currently which is parent to which) module to connect, then us

Re: marine subroutine

2007-08-31 Thread Dr.Ruud
"Chas Owens" schreef: > An article would be redundant, we already have Tom Christiansen's > masterful article "Far More Than Everything You've Ever Wanted to Know > about Prototypes in Perl"*. [...] > * http://library.n0i.net/programming/perl/articles/fm_prototypes/ OK, thanks. I presume it is qu

import CSV files in MYSQL

2007-08-31 Thread Ana
Hello people.. I have one file with data in CSV where first line is header.. Don't have one module for this? Thanks :D -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: grabbing content from tree builder

2007-08-31 Thread Rob Dixon
Rob Dixon wrote: Hunter Barrington wrote: so i have the following code: foreach my $node (@tables){ my @rows = $node->look_down(_tag => 'tr'); foreach my $row (@rows){ #grabbing data from each row at this point my @part_cell = $row->splice_content(3, 1); #part number

Re: grabbing content from tree builder

2007-08-31 Thread Rob Dixon
Hunter Barrington wrote: so i have the following code: foreach my $node (@tables){ my @rows = $node->look_down(_tag => 'tr'); foreach my $row (@rows){ #grabbing data from each row at this point my @part_cell = $row->splice_content(3, 1); #part number my $cell = $part

Re: grabbing content from tree builder

2007-08-31 Thread Chas Owens
On 8/31/07, Hunter Barrington <[EMAIL PROTECTED]> wrote: > so i have the following code: > > foreach my $node (@tables){ > my @rows = $node->look_down(_tag => 'tr'); > foreach my $row (@rows){ #grabbing data from each row at this point > my @part_cell = $row->splice_content(3,

Re: finding methods and attributes in a name space

2007-08-31 Thread Chas Owens
On 8/31/07, Hunter Barrington <[EMAIL PROTECTED]> wrote: > how would i find out what attributes and methods are in a name space? > for example i have an object in my code and im not sure what type it is, > what attributes are associated with it, what methods etc etc how can i > find out. in python

grabbing content from tree builder

2007-08-31 Thread Hunter Barrington
so i have the following code: foreach my $node (@tables){ my @rows = $node->look_down(_tag => 'tr'); foreach my $row (@rows){ #grabbing data from each row at this point my @part_cell = $row->splice_content(3, 1); #part number my $cell = $part_cell[0]; next

Re: html template and tables

2007-08-31 Thread Chas Owens
On 8/30/07, Pat Rice <[EMAIL PROTECTED]> wrote: snip > #!/usr/bin/perl > > use strict; > use warnings; Good form, keep doing this. > > my $data_file = 'myfile/var/log/my.log'; > print "$data_file \n"; > ># Open the file for reading. > open (DATA, "$data_file") or die "can't open $data_file $!

Re: debugging Perl/XS

2007-08-31 Thread Robert Hicks
Chas Owens wrote: On 8/31/07, Robert Hicks <[EMAIL PROTECTED]> wrote: Are there any pointers somewhere? snip The following url seems like it might be helpful; unfortunately I can't seem to break my bad habit of debugging with print/printf, so I haven't tried to use a real debugger with XS code

Re: type comparison in perl

2007-08-31 Thread Gunnar Hjalmarsson
Hunter Barrington wrote: is there a type() function in perl? i need to be able to test the contents of an array and if (type($value)=='string' or type($value)=='int') {print "i win";} thats basically what i need to be able to do. if it helps i know ahead of time that the two type in the array

type comparison in perl

2007-08-31 Thread Hunter Barrington
is there a type() function in perl? i need to be able to test the contents of an array and if (type($value)=='string' or type($value)=='int') {print "i win";} thats basically what i need to be able to do. if it helps i know ahead of time that the two type in the array will always be a hashref o

Re: create a uft8 file

2007-08-31 Thread Chas Owens
On 8/31/07, Digger <[EMAIL PROTECTED]> wrote: > Hello, > > I want to create an utf8 file and write some content (like html codes) to it. > How to do it? thanks. snip Modern Perl handles utf8 natively. You can do things like: #!/usr/bin/perl use strict; use warnings; open my $fh, ">", "outfile"

Re: Big unicode problem with Perl 5.8.8 with MySQL 5.0 (i.e. Debian 4.0)

2007-08-31 Thread Karjala
Thanks, I solved the problem by following the advice on the second comment on this page: http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html Chas Owens wrote: On 8/29/07, Karjala <[EMAIL PROTECTED]> wrote: snip I'm desperate for a solution, a hint, or if you run Debian to pleas

Re: Big unicode problem with Perl 5.8.8 with MySQL 5.0 (i.e. Debian 4.0)

2007-08-31 Thread Chas Owens
On 8/29/07, Karjala <[EMAIL PROTECTED]> wrote: snip > I'm desperate for a solution, a hint, or if you run Debian to please try > these short scripts on your machine to tell me whether you're getting > the same results (or better ones). snip Have you tried doing the insert from the mysql command to

Re: debugging Perl/XS

2007-08-31 Thread Chas Owens
On 8/31/07, Robert Hicks <[EMAIL PROTECTED]> wrote: > Are there any pointers somewhere? snip The following url seems like it might be helpful; unfortunately I can't seem to break my bad habit of debugging with print/printf, so I haven't tried to use a real debugger with XS code. http://use.perl.o

Re: Logging STDERR and other output

2007-08-31 Thread Dr.Ruud
"Beginner" schreef: > Log::Handler looks pretty comprehensive. Consider also Log::Log4Perl. http://search.cpan.org/~mschilli/Log-Log4perl/lib/Log/Log4perl/FAQ.pm -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PRO

Re: File::Find

2007-08-31 Thread Rob Dixon
Somu wrote: use strict; use warnings; use File::Find; sub rm(); Remove the (). This prototypes the subroutine to force it to have no parameters. sub rm; In fact leaving this line out altogether is probably the best option. The subroutine doesn't need to be declared early. my $count=0; my

Re: File::Find

2007-08-31 Thread Omega -1911
On 8/31/07, Somu <[EMAIL PROTECTED]> wrote: > use strict; > use warnings; > use File::Find; > sub rm(); > my $count=0; > my @dir = ("F://Hindi/RHTDM"); > find(&rm,@dir); > > sub rm(){$count++ > my ($fname)= $_; > if($fname=~ /mp3/){print "$count $fname"} > } PLEASE!!! Before coming to this list an

Re: Facing problem with perl one-liner for single quote

2007-08-31 Thread Gunnar Hjalmarsson
John W. Krahn wrote: Gunnar Hjalmarsson wrote: John W. Krahn wrote: If the OP were on windows then he won't have been able to use single quotes for the original. If I understood it correctly, he wasn't... Krishnan Hariharan wrote: > > I wrote this one liner, > > perl -pi -e 's/signal T

Re: File::Find

2007-08-31 Thread Somu
Those double dollar signs are formatting errors of my mail server. And with the code i posted, the error has to be at the if statement in the rm definition -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: File::Find

2007-08-31 Thread Somu
use strict; use warnings; use File::Find; sub rm(); my $count=0; my @dir = ("F://Hindi/RHTDM"); find(&rm,@dir); sub rm(){$count++ my ($fname)= $_; if($fname=~ /mp3/){print "$count $fname"} } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://le

Re: LWP::Authen::Ntlm::authenticate

2007-08-31 Thread iwaim
Hello. [EMAIL PROTECTED] (Michael Gale) wrote: > Hey, > > Has anyone had any luck withNTLMauth with LWP ? I also had the same problem as you. I found a report. #9521: Authentication to IIS 5.0 server fails repeatedly with 401 errors http://rt.cpan.org/Public/Bug/Display.html?id=9521 The

Re: File::Find

2007-08-31 Thread Rob Dixon
Somu wrote: It gave the error Use of uninitialized value in pattern match (m//) at test.pl line 13. Can't use string ("") as a subroutine ref while "strict refs" in use at C:/Perl/lib/File/Find.pm line 822. Please show your code. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addition

Re: File::Find

2007-08-31 Thread Omega -1911
On 8/31/07, Somu <[EMAIL PROTECTED]> wrote: > It gave the error > > Use of uninitialized value in pattern match (m//) at test.pl line 13. > Can't use string ("") as a subroutine ref while "strict refs" in use > at C:/Perl/lib/File/Find.pm line 822. > > > ??? > > On 8/29/07, Omega -1911 <[EMAIL PRO

WG: Open files and looking a word

2007-08-31 Thread Angerstein
Net::Ping has serveral Bugs and is not threatsafe. I posted a fix here and asked for help to fix and upload to cpan... There is an error in setting up the dataframe and an error in building the identification number. Use net-ping-external or use Backticks and ping. If you just read a logfile,

Re: parsing HTML content

2007-08-31 Thread ladder49
On Aug 30, 9:37 pm, [EMAIL PROTECTED] (Daniel Kasak) wrote: > On Thu, 2007-08-30 at 07:16 -0700, ladder49 wrote: > > Is there a way to dump the HTML code for a web page? I need to write > > a script which will collect and summarize content from intranet web > > pages. By dump, I mean to read it t

Re: File::Find

2007-08-31 Thread Somu
It gave the error Use of uninitialized value in pattern match (m//) at test.pl line 13. Can't use string ("") as a subroutine ref while "strict refs" in use at C:/Perl/lib/File/Find.pm line 822. ??? On 8/29/07, Omega -1911 <[EMAIL PROTECTED]> wrote: > On 8/28/07, Randal L. Schwartz <[EMAIL PRO

debugging Perl/XS

2007-08-31 Thread Robert Hicks
Are there any pointers somewhere? Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Open files and looking a word

2007-08-31 Thread Chas Owens
On 8/31/07, Rodrigo Tavares <[EMAIL PROTECTED]> wrote: > Hello, > > I'm doing a script, it run a ping in many computers > and create a log file. > > I need search in log file the word "Destination Host > Unreachable". So, I have to take below line. After > using regular expressions taking ferrari.

Open files and looking a word

2007-08-31 Thread Rodrigo Tavares
Hello, I'm doing a script, it run a ping in many computers and create a log file. I need search in log file the word "Destination Host Unreachable". So, I have to take below line. After using regular expressions taking ferrari.lab and print "The host is down !". example: PING ferrari.lab (192.

finding methods and attributes in a name space

2007-08-31 Thread Hunter Barrington
how would i find out what attributes and methods are in a name space? for example i have an object in my code and im not sure what type it is, what attributes are associated with it, what methods etc etc how can i find out. in python there was dir() and type() which was a big help. anything sim

Re: marine subroutine

2007-08-31 Thread Chas Owens
On 8/31/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: snip > This is nice content, but not presented well, so I wonder how many > people take the time to read and grok it. > > Maybe you can transform it into an article, maybe both on this list and > on PerlMonks? > > (and please give away the answers :) s

create a uft8 file

2007-08-31 Thread Digger
Hello, I want to create an utf8 file and write some content (like html codes) to it. How to do it? thanks. GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.crawler.com/smileys Works with AIM®, MSN® Messenger, Yahoo!® Mes

Re: marine subroutine

2007-08-31 Thread Dr.Ruud
"Chas Owens" schreef: > Martin Barth: >> Andrew Curry: >>> That's rubbish, >> >> but you get a warning like: >> >> main::a() called too early to check prototype at -e line 1. >> >> Use Prototypes at the beginning of your file if you want to write the >> subs at the end. > snip > > This would be a

Re: Logging STDERR and other output

2007-08-31 Thread Dr.Ruud
"Beginner" schreef: > Adriano Ferreira: >> use lib qw(/etc/perl); > > use lib ('/etc/perl'); The idiom adivised by Adriano is more flexible. See `perldoc lib`. Example: use lib qw( /usr/local/cvs_tree/lib /etc/perl ); -- Affijn, Ruud "Gewoon is een tijger."

Re: Facing problem with perl one-liner for single quote

2007-08-31 Thread Krishnan Hariharan
Hello all, Thanks for your help. I tried using "\047" ASCII for the single quote in the substitution and it worked. The OS am using is Sun Solaris. Regards, HK. --- "John W. Krahn" <[EMAIL PROTECTED]> wrote: > Gunnar Hjalmarsson wrote: > > John W. Krahn wrote: > >> Gunnar Hjalmarsson wrote: