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-
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
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:
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
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 |
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/
[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
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
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)
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?
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.
###
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
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
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
#!/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
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
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
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
--
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
#!/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
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
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:
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
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
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
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
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
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?
28 matches
Mail list logo