Re: macthing question...

2002-12-31 Thread R. Joseph Newton
Hi Mike, Try something like the following. It actually takes an extra step, by making a hash opf all lines, then searching it for the keys that have the desired numerical prefix. There is a purpose to that. A few small edits will allow this to report all of the strings, grouped by prefix.

Re: more socket stuff - 2nd part

2002-12-31 Thread Mark Goland
Sorry, I dont know much about IO::Socket module, but here are some tips use IO::Socket qw (:DEFAULT :crlf); $EOL1 = \012; $EOL2 = \015; can be $/=crlf; so no more of, $input =~ s/$EOL1//g; $input =~ s/$EOL2//g; just chomp($input); this is how threading and forking would work. After your

using \n in a cgi script

2002-12-31 Thread dhoubrechts
Every time I want to use a perl script as a cgi the \n ending the phrases doesn't make it going at the beginning of the next line. Why ? Several script coming from Perl in Action (O'Reilly) have those \n ending those phrases. Here are some lines coming from one of them : sub document_de_garde {

Re: Regexp with //x

2002-12-31 Thread Rob Dixon
[EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Can anyone tell me where to find out what the x does when used at the end of a pattern match? (i.e. $tag =~ /abc/x) perldoc perlre Everywhere I've looked gives me the helpful information that it means Use

Re: ANDing IP addresses

2002-12-31 Thread Mark Goland
I know there was already solution posted, just wrote my own ver of it. print Enter the IP address: ; $ip = ; print Enter the Subnet address: ; $sn = ; chomp $ip; chomp $sn; $ip=CIDR2bin($ip); $sn=CIDR2bin($sn); printf The network adr is: %vd\n, $ip $sn; sub CIDR2bin{ return pack 'c4',split

Re: ANDing IP addresses

2002-12-31 Thread Paul Johnson
On Sat, Dec 28, 2002 at 11:24:36PM -0800, R. Joseph Newton wrote: I'd say don't bother pack()ing. At the moment, I think the function pretty much s**ks. use eval() instead. The following doesn't have pack and unpack are good for what they are good at. If you need their functionality, use

Re: macthing question...

2002-12-31 Thread Rob Dixon
Hi Mike. Something like: while () { if ( /^(\d\d\d)\s*([^]+)/ ) { ($level, $text) = (0+$1, $2); print $level $text\n; } } will do what you want. It looks for lines starting with three digits, optional spaces and a double quote. It

Re: macthing question...

2002-12-31 Thread Rob Dixon
Hi Joseph Just a thought: if ( !$_ or $_ eq ) {next;} is a C idiom, where a string is represented as a char* which may be NULL or may point to a zero-length string. In Perl a simple if ( !$_ ) {next;} or, better next unless $_; Cheers, Rob R. Joseph Newton [EMAIL PROTECTED]

Re: using \n in a cgi script

2002-12-31 Thread Rob Dixon
Bonjour M Dhoubrechts Si je vous comprends .. If I understand you, you're expecting the characters '\n' to appear in the printed output? In Perl, '\n' is one of the short ways of expressing a single ASCII control character, this one is LF - or 'linefeed' - which has value 10 in the ASCII

Re: more socket stuff - 2nd part

2002-12-31 Thread Mat Harris
I wonder if forking could really be as easy as putting fork() in the place you have marked. It will be great if it does, but I am sure there is loads of other stuff like managing pid's etc. Lets hope you are right. Not a DHCP server, its the update system for a dynamic DNS server. I found a DNS

Re: more socket stuff - 2nd part

2002-12-31 Thread Mat Harris
amazing, just putting fork(); above the while($client=$server-accept) statement has worked. I can now accept multiple connections. If had thought it would be that easy, I would have been using that long ago. Cheers Mark On Tue, Dec 31, 2002 at 05:59:42 -0500, Mark Goland wrote: fork...child

Re: using \n in a cgi script

2002-12-31 Thread Jenda Krynicky
From: dhoubrechts [EMAIL PROTECTED] Every time I want to use a perl script as a cgi the \n ending the phrases doesn't make it going at the beginning of the next line. Why ? Several script coming from Perl in Action (O'Reilly) have those \n ending those phrases. Here are some lines coming from

Thanks, Bob Showalter! (glob question)

2002-12-31 Thread David Eason
Thanks for your suggestions on the glob / join simplification question. And yes, Win32 is the reason I don't have shell globbing. Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: glob subtlety question

2002-12-31 Thread David Eason
Thanks to all! David Eason [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is there a better way to say: my @input_files = glob (join , @ARGV) unless $#ARGV = -1; foreach my $doc ( @input_files ) { ... __code goes here___ } I put the unless clause in there

Re: Die horribly ?

2002-12-31 Thread David Eason
Pseudocode is not intended to be compiled and is used to illustrate the logic of an algorithm, e.g.: if address file is found set count to 0 do count = count + 1 read a record until no more records endif Mystik Gotan [EMAIL PROTECTED] wrote in message [EMAIL

Really stuck: DBI, mysqlPP.

2002-12-31 Thread Craig Williams
Ok, firstly - I don't believe this is a mysql issue as I have a working server which I can prove and the fact I've just learnt Perl was my reason for posting here, maybe I've screwed up the syntax. I just installed the modules for DBI and MySQL and they seem to work great except for one aspect.

how to make die really dies on windows?

2002-12-31 Thread Mrtlc
I have a script gonnadie.pl ##gonnadie.pl do_sth die blah blah; gonnadie.pl is called by a DOS batch file x.bat REM - x.bat perl gonnadie.pl x.bat is called by y.bat REM - y.bat x.bat When y.bat is run, the OS treats x.bat ends sucessfully, how can I make y.bat dies when gonnadie.pl dies?

Re: Perl editors

2002-12-31 Thread Kieren Diment
On Sun, Dec 29, 2002 at 10:46:36AM +, Gavin Laking wrote: Hi folks, I'm currently using a mixture of Quanta[1], jEdit[2] and Kate[3] (all Linux) for my Perl editing needs, but I'm wondering if there are any specialised editors(preferably free) which others are using. In my ideal world

Parsing PDF

2002-12-31 Thread jose ajosh
Hi All, Could anybody help me in parsing PDFs (each line in pdf) using perl. I tried using PDF::Core and PDF::Parse. But I could able to parse only informations available in the PDF title. Thanks Ajosh __ Do you Yahoo!? Yahoo! Mail Plus -

Re: Really stuck: DBI, mysqlPP.

2002-12-31 Thread Jenda Krynicky
To: [EMAIL PROTECTED] From: Craig Williams [EMAIL PROTECTED] Subject:Really stuck: DBI, mysqlPP. Date sent: Tue, 31 Dec 2002 00:48:44 - Ok, firstly - I don't believe this is a mysql issue as I have a working server which I

Re: how to make die really dies on windows?

2002-12-31 Thread Jenda Krynicky
From: Mrtlc [EMAIL PROTECTED] I have a script gonnadie.pl ##gonnadie.pl do_sth die blah blah; gonnadie.pl is called by a DOS batch file x.bat REM - x.bat perl gonnadie.pl x.bat is called by y.bat REM - y.bat x.bat When y.bat is run, the OS treats x.bat ends sucessfully,

RE: WELCOME to beginners@perl.org

2002-12-31 Thread Frank Naude
Hi, Can somebody please help me to get this code fixed? Since I've moved the DB_File tie and untie functions to sub's, data is never written to the database. I've tried both call-by-refeence and call-by-value methods without any luck. use strict; use DB_File; sub openDB { my %db;

tied hash passing (was RE: WELCOME to beginners@perl.org)

2002-12-31 Thread Jenda Krynicky
From: Frank Naude [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject:RE: WELCOME to [EMAIL PROTECTED] Date sent: Tue, 31 Dec 2002 15:39:55 +0200 How's this related to the welcome message??? Can somebody please help me to get this

RE: more socket stuff - 2nd part

2002-12-31 Thread Bob Showalter
Mat Harris wrote: i have sorted the two-way communication stuff but no I am having trouble doing the multithreaded version. I have no experience using fork or anything to do with spawing or pid's. Looking at the multithreaded server example on the sockets page on perldoc.com, please could

DBI Problem

2002-12-31 Thread Michael Kramer
Ok I've tried everything I could think of and have gone to about 100 website on the subject of DBI. I've downloaded the module and have tried to install it on os 9.1 using macperl and os 10.2 using the built-in perl (which I think I need to update perl 5.6). I can't figure out how to Install any

RE: Really stuck: DBI, mysqlPP.

2002-12-31 Thread Dan Muey
I have this in a working script runs no problem at all. Mysql version 3.26 I think. Do you verify that that the query was executed? If the query gets bad then it will never get to your while loop. You could use DBI-trace to see what's going on. $query = DESCRIBE $existing_table_name;

RE: DBI Problem

2002-12-31 Thread Bob Showalter
Michael Kramer wrote: I can't figure out how to Install any module is there some sort of trick? Read perldoc perlmodinstall (describes the manual way) perldoc CPAN (describes the automated way) Here's the same info on the web: http://www.perldoc.com/perl5.8.0/pod/perlmodinstall.html

PERL\CGI question...

2002-12-31 Thread Richard.C.1
The ISP that I use seems to be always restoring files with the result that although my PERL files are there, the permissions get clobbered when they do the restore. Is there any way I can write a PERL\CGI program that I can run on the server that will allow me to reset the permissions on a file?

RE: PERL\CGI question...

2002-12-31 Thread Nigel Peck - MIS Web Design
You should be able to write a script to use chmod to do it. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 31 December 2002 15:25 To: [EMAIL PROTECTED] Subject: PERL\CGI question... The ISP that I use seems to be always restoring files with the result that

RE: Perl editors

2002-12-31 Thread Paul Kraus
I am running emacs for windows. How do I use these debugging options? I currently use cperl mode. -Original Message- From: Kieren Diment [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 31, 2002 1:44 AM To: Gavin Laking Cc: [EMAIL PROTECTED] Subject: Re: Perl editors On

Re: Really stuck: DBI, mysqlPP.

2002-12-31 Thread Craig Williams
Hi, Ok, I tried what you suggested below and upgraded mysql to the latest version 3.23.54(stable) and still get no results. To verify the statements do run, I changed the query to Select * from tablex and that works fine also added the die statements, no errors. thanks Craig Dan Muey

Re: Really stuck: DBI, mysqlPP.

2002-12-31 Thread Craig Williams
Thank You! That worked. I had tried the {NAME} option before but I thought it returned a reference to the result array and so de-referenced it first, probably breaking it ;-) Regards, Craig Jenda Krynicky [EMAIL PROTECTED] wrote in message

Re: Really stuck: DBI, mysqlPP.

2002-12-31 Thread Jenda Krynicky
From: Craig Williams [EMAIL PROTECTED] That worked. I had tried the {NAME} option before but I thought it returned a reference to the result array and so de-referenced it first, probably breaking it ;-) But the $sth-{NAME} is a reference to an array. How did you dereference

DBI::st

2002-12-31 Thread gkhgkh
Does anyone know where I can find the DBI::st module? If have looked on CPAN and Activestate and cannot locate it. Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: DBI::st

2002-12-31 Thread Jenda Krynicky
From: [EMAIL PROTECTED] Does anyone know where I can find the DBI::st module? If have looked on CPAN and Activestate and cannot locate it. DBI::st is one of the namespaces/packages defined within DBI.pm Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine,

Re: two questions

2002-12-31 Thread Adriano Allora
Lunedì, 30 Dic 2002, alle 23:38 Europe/Rome, Wiggins d'Anconia ha scritto: Adriano Allora wrote: hi to all, I'd like to know two things: 1 - Perl vs. AWK I'm learning Perl to use it in text processing. Recently I start to argue with a friend of mine about the best language to process texts

RE: two questions

2002-12-31 Thread Dan Muey
Try : @file = INPUT; foreach $line(@file) { if($line) { # or regex above to make sure the line you're using id the proper format @tmp = ''; # undef or whatever @tmp = split(/\t/, $line); push(@new, $tmp[0]); push(@orig,

RE: two questions

2002-12-31 Thread Dan Muey
I used \t assuming you were using a tab delimeted values, just fyi. You may need to do split(/ /, $line) if the \t doesn't work on your system. -Original Message- From: Dan Muey Sent: Tuesday, December 31, 2002 11:23 AM To: Adriano Allora; [EMAIL PROTECTED] Subject: RE: two

Re: Really stuck: DBI, mysqlPP.

2002-12-31 Thread Craig Williams
hehe ok, partly right. I did; @$fields = $sth-{NAME}; Craig Jenda Krynicky [EMAIL PROTECTED] wrote in message 3E11CE1A.16361.36E9ED7D@localhost">news:3E11CE1A.16361.36E9ED7D@localhost... From: Craig Williams [EMAIL PROTECTED] That worked. I had tried the {NAME} option before

substitution or matching regex

2002-12-31 Thread David O'Dell
I have a variable: $NUM = '14.45905495'; and I want to remove the trailing digits and only leave 2 after the period so it ends up '14.45' I've tried to do this but it appears to return as an array and always prints out 1. #!perl -w $NUM = '14.45905495'; @POST = ($NUM =~ /\d\.\d{2}/); print new

Re: two questions

2002-12-31 Thread wiggins
snip I don't like who look for a complete and correct script here, but I cannot solve my problem: this is my input-type: Dante Alighieri Cecco Angiolieri Brunetto Latini EugenioMontale GiacomoLeopardi NiccolòTommaseo Guido Gozzano (and so

RE: substitution or matching regex

2002-12-31 Thread wiggins
You may want to do this with sprintf rather than a regex, check out: perldoc -f sprintf I believe because your regex isn't grouping any terms it is returning a status of true or false, aka 1 for true since your regex does in fact match. You might try paren's around the whole thing if you still

RE: substitution or matching regex

2002-12-31 Thread Kipp, James
I have a variable: $NUM = '14.45905495'; and I want to remove the trailing digits and only leave 2 after the period so it ends up '14.45' I've tried to do this but it appears to return as an array and always prints out 1. #!perl -w $NUM = '14.45905495'; @POST = ($NUM =~

RE: substitution or matching regex

2002-12-31 Thread Paul Kraus
#!/usr/bin/perl $num=14.45905495; @post=$1 if ($num=~/(\d+\.\d\d)\d+/); print $post[0]\n; output 14.45 explanation -- \d+ = at least one digit or more \. = followed by a period. \d\d = two digits \d+ = followed by any number of digits (\d+\.\d\d) Sets the portion in parens to be

IO::Handle, fdopen, and file descriptor #

2002-12-31 Thread wiggins
I am making a call to gpg on the command line, a couple of the parameters that gpg will accept are file descriptor numbers that it then writes to, and I would like to capture that output and then read from it. I have successfully made it read directly from a file on the local file system like

dbi mysql question

2002-12-31 Thread Dan Muey
Does any one happen to know if it's possible to do a query within a query : For instance : This is for demonstartion purposes and is not executable code : prepare $sth -$dbh... execute $sth -$dbh $sth -$dbh fetchrowarray { $sth2 -$dbh prepare $sth 2-$dbh execute $sth 2-$dbh

RE: dbi mysql question

2002-12-31 Thread Dan Muey
Answer my own question. Yes it is possible, no problem. My problem was an obscure infinite loop. So nevermind! Thanks Dan -Original Message- From: Dan Muey Sent: Tuesday, December 31, 2002 1:43 PM To: [EMAIL PROTECTED] Subject: dbi mysql question Does any one happen to know if it's

RE: :Handle, fdopen, and file descriptor #

2002-12-31 Thread Kipp, James
I am making a call to gpg on the command line, a couple of the parameters that gpg will accept are file descriptor numbers that it then writes to, and I would like to capture that output and then read from it. I have successfully made it read directly from a file on the local file system

Re: WELCOME to beginners@perl.org

2002-12-31 Thread Rob Dixon
Hi Frank See in-line. Frank Naude [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, Can somebody please help me to get this code fixed? Since I've moved the DB_File tie and untie functions to sub's, data is never written to the database. I've tried both

Re: more socket stuff - 2nd part

2002-12-31 Thread Mat Harris
Mark Goland wrote: glad it worked, although the fork() was sepose to be after the while loop. Cheers, Mark - Original Message - From: Mat Harris [EMAIL PROTECTED] To: Mark Goland [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, December 31, 2002 6:08 AM Subject: Re: more socket

Re: glob subtlety question

2002-12-31 Thread Rob Dixon
Sorry to drag this one up again, but it doesn't seem to have been answered properly. Surely the answer is: my @input_files = map glob, @ARGV; which will also leave @input_files empty if @ARGV is empty. Cheers all, Rob David Eason [EMAIL PROTECTED] wrote in message [EMAIL

Re: glob subtlety question

2002-12-31 Thread Jenda Krynicky
From: Rob Dixon [EMAIL PROTECTED] Sorry to drag this one up again, but it doesn't seem to have been answered properly. Surely the answer is: my @input_files = map glob, @ARGV; which will also leave @input_files empty if @ARGV is empty. The problem is that it will also glob the stuff

RE: :Handle, fdopen, and file descriptor #

2002-12-31 Thread wiggins
On Tue, 31 Dec 2002 15:31:47 -0500, Kipp, James [EMAIL PROTECTED] wrote: I am making a call to gpg on the command line, a couple of the parameters that gpg will accept are file descriptor numbers that it then writes to, and I would like

Re: using \n in a cgi script

2002-12-31 Thread R. Joseph Newton
Hi, Look at your source for the web page. You will see: H1Salut\nbsp;!/H1 Bienvenue dans notre magasin d'habillement\nbsp; Faites votre choix dans le menu ci-dessous Which will show up in your browser as:#apologies to those without HTML-enabled mail clients Salut Bienvenue dans notre