RE: Escaping a plus sign

2006-05-31 Thread Ken Lehman
Is it the if ($MGMTCMNT =~ /$MGMTNM/) part that is tripping you up? I believe you could change it to if ($MGMTCMNT =~ /\Q$MGMTNM\E/) if you need to keep the regular expression. Another idea might be to change it to if ( ($start = index($MGMTCMNT, $MGMTNM ()) 0) { -Original Message-

regex matching

2006-05-31 Thread cknipe
Hi, if ($_ =~ m/match string/i) { if ($_ =~ m/does not match string/i) { } else { print $_; Regex is not my strong point, so I'm going to ask... Is there any way to write that better? Preferably only using one if statement? if (($_ =~ m/match string/i) ($_ =~ m/does not match

Re: regex matching

2006-05-31 Thread cknipe
if (($_ =~ m/match string/i) ($_ !~ m/does not match string/i)) { Works flawlessly, thanks allot... -- Chris Quoting Shashidhara Bapat [EMAIL PROTECTED]: Hi, yes you can do that. For not match, you got to use !~. - shashi On 5/31/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Re: regex matching

2006-05-31 Thread Mr. Shawn H. Corey
On Wed, 2006-31-05 at 12:03 +0200, [EMAIL PROTECTED] wrote: Hi, if ($_ =~ m/match string/i) { if ($_ =~ m/does not match string/i) { } else { print $_; Regex is not my strong point, so I'm going to ask... Is there any way to write that better? Preferably only using

hash and array question

2006-05-31 Thread Andrej Kastrin
Dear Perl users, below is three column, vertical bar separated file. First column refers to ID number, second designates name and the last one refers to corresponding value. There are 8 possible names: A, B, C, D, E, F, G and H (only first seven preset in my dataset) 1 | C | 0.404 1 | D |

Re: Escaping a plus sign

2006-05-31 Thread Dr.Ruud
Paul Nowosielski schreef: The script will die if the is a + sign in the fields its parsing. perldoc -f quotemeta -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: regex matching

2006-05-31 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi, Hello, if ($_ =~ m/match string/i) { if ($_ =~ m/does not match string/i) { } else { print $_; According to that logic: $ perl -le' for ( abcdefgh, rstuvwxyz, jklmnop, abcdefwxyz ) { if ( /cde/i ) { if ( !/xyz/i ) { } else { print

Re: hash and array question

2006-05-31 Thread John W. Krahn
Andrej Kastrin wrote: Dear Perl users, Hello, below is three column, vertical bar separated file. First column refers to ID number, second designates name and the last one refers to corresponding value. There are 8 possible names: A, B, C, D, E, F, G and H (only first seven preset in my

Re: hash and array question

2006-05-31 Thread Muma W.
Andrej Kastrin wrote: Dear Perl users, below is three column, vertical bar separated file. First column refers to ID number, second designates name and the last one refers to corresponding value. There are 8 possible names: A, B, C, D, E, F, G and H (only first seven preset in my dataset)

Simple loop question

2006-05-31 Thread Danny
Hi list, Hope this is not too simple or a stupid question: I have a slight problem with a loop. It is a simple numbers guessing game. It works fine, but when I run this script, it gives me Too low immediately after the prompt. What should I do to get the last else statement displayed first?

RE: Simple loop question

2006-05-31 Thread Timothy Johnson
Here's one way to accomplish what you want, and it eliminates some of the redundancy. BTW, get used to using strict. It really does help in the long run and it's better to learn it early than to decide to go back later and fix your old programs. ###

Re: Simple loop question

2006-05-31 Thread Mr. Shawn H. Corey
On Wed, 2006-31-05 at 17:58 +0200, Danny wrote: Hi list, Hope this is not too simple or a stupid question: I have a slight problem with a loop. It is a simple numbers guessing game. It works fine, but when I run this script, it gives me Too low immediately after the prompt. What should

faster search engine for fulltext search

2006-05-31 Thread Octavian Rasnita
Hi, I am using a perl program (mod_perl handler) that searches a MySQL database which has a few hundread thousands records, using a fulltext index, but it works pretty slow. When very many records are found, it takes very many seconds or even tens of seconds to finish searching the database. Do

Re: Simple loop question

2006-05-31 Thread Lawrence Statton
Hi list, Hope this is not too simple or a stupid question: I have a slight problem with a loop. It is a simple numbers guessing game. It works fine, but when I run this script, it gives me Too low immediately aft er the prompt. What should I do to get the last else statement displayed

Re: Simple loop question

2006-05-31 Thread Lawrence Statton
#!/usr/bin/perl use strict; use warnings; our ($upper, $lower, $target) = ( 20, 1, 11 ); D'oh! I really _meant_ to make those lexical instead of package variables - another good habit to get in early. my ($upper, $lower, $target) = (20,1,11); -- To unsubscribe, e-mail: [EMAIL

Re: Simple loop question [SOLVED]

2006-05-31 Thread Danny
Hi list, Thank you all who responded to my question and in particular Dr MindHacker. After I saw the corrected code, I realized how I am supposed to think in perl. Thank you very much. Danny Danny, The code is below, I ran a simple test and it worked. The Please choose ... part

Re: faster search engine for fulltext search

2006-05-31 Thread Todd W
Octavian Rasnita [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I am using a perl program (mod_perl handler) that searches a MySQL database which has a few hundread thousands records, using a fulltext index, but it works pretty slow. When very many records are found, it

Re: Simple loop question

2006-05-31 Thread Danny
Get in the habit of using strict and warnings -- 'use warnings' is subtly different from 'perl -w' and you should start good habits early. Upgrade if you are using an ancient version of Perl that does not come with warnings. So would it be a conflict to use both -w and strict? Danny --

Re: Simple loop question

2006-05-31 Thread Danny
Here's one way to accomplish what you want, and it eliminates some of the redundancy. BTW, get used to using strict. It really does help in the long run and it's better to learn it early than to decide to go back later and fix your old programs. I am making it a habbit now. Thank you very

Re: Simple loop question

2006-05-31 Thread Danny
#!/usr/bin/perl use strict; use warnings; our ($upper, $lower, $target) = ( 20, 1, 11 ); D'oh! I really _meant_ to make those lexical instead of package variables - another good habit to get in early. my ($upper, $lower, $target) = (20,1,11); Will do (promise)... Danny

Re: Russian character support

2006-05-31 Thread JupiterHost.Net
SkyBlueshoes wrote: How can I get Russian/other language character support for my script? Is there a certain module? use the proper charset, utf8, etc and print them out :) What have you found with perldoc and search.cpan.org ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: faster search engine for fulltext search

2006-05-31 Thread JupiterHost.Net
Next, your op says When very many records are found... What is the purpose of your client program loading large recordsets? You should probably be paging the data somehow. Perhaps doing your queries to return only some instead of all records will help, a great module for doing this is:

Re: Simple loop question

2006-05-31 Thread Mr. Shawn H. Corey
On Wed, 2006-31-05 at 20:03 +0200, Danny wrote: Get in the habit of using strict and warnings -- 'use warnings' is subtly different from 'perl -w' and you should start good habits early. Upgrade if you are using an ancient version of Perl that does not come with warnings. So would it

Perl script to search and replace a string in a file

2006-05-31 Thread Nishi Bhonsle
Hi: I have the following script that takes in an input file, output file and replaces the string in the input file with some other string and writes out the output file. I want to change the script to traverse through a directory of files ie instead of prompting for input and output files, the

RE: Perl script to search and replace a string in a file

2006-05-31 Thread Timothy Johnson
Check out the File::Find module. It should come standard with your distribution. -Original Message- From: Nishi Bhonsle [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 31, 2006 2:39 PM To: beginners@perl.org Subject: Perl script to search and replace a string in a file Hi: I have the

Re: Simple loop question

2006-05-31 Thread John W. Krahn
Danny wrote: Hi list, Hello, Hope this is not too simple or a stupid question: I have a slight problem with a loop. It is a simple numbers guessing game. It works fine, but when I run this script, it gives me Too low immediately after the prompt. What should I do to get the last else

Re: Perl script to search and replace a string in a file

2006-05-31 Thread Ricky Zhou
On 5/31/06, Nishi Bhonsle [EMAIL PROTECTED] wrote: I have the following script that takes in an input file, output file and replaces the string in the input file with some other string and writes out the output file. I want to change the script to traverse through a directory of files ie instead

Re: Simple loop question

2006-05-31 Thread Lawrence Statton
Get in the habit of using strict and warnings -- 'use warnings' is subtly different from 'perl -w' and you should start good habits early. Upgrade if you are using an ancient version of Perl that does not come with warnings. So would it be a conflict to use both -w and strict?