Exact matching using GREP.

2005-09-08 Thread Sara
my @present = ('perl', 'perl/chat', 'php', 'php/forums', 'php/counters', 'perl/search/scripts', 'php'); # Getting Results for mySQL query in hashref. while (my $row = $sth-fetchrow_hashref) { if (grep /$row-{CAT_TITLE}/, @present) { #matching title with @present elements print

Re: Exact matching using GREP.

2005-09-08 Thread Ovid
--- Sara [EMAIL PROTECTED] wrote: while (my $row = $sth-fetchrow_hashref) { if (grep /$row-{CAT_TITLE}/, @present) { #matching title with @present elements print $row-{CAT_TITLE}; } Question is how to do EXACT matching using GREP? because the above code prints every element

Re: Exact matching using GREP.

2005-09-08 Thread Sara
No, it's not working, probably you didnt' get my question. Anyways, thanks for a prompt reply. Sara. - Original Message - From: Ovid [EMAIL PROTECTED] To: beginners-cgi@perl.org Sent: Friday, September 09, 2005 12:01 AM Subject: Re: Exact matching using GREP. --- Sara [EMAIL

Re: Exact matching using GREP.

2005-09-08 Thread Wiggins d'Anconia
Please bottom post Sara wrote: No, it's not working, probably you didnt' get my question. How is it not working now? What Ovid sent is exactly what I would have answered so you probably need to provide more information. You mention man pages and switches to grep, there are two greps here,

catchDate

2005-09-08 Thread Christopher Spears
I want to catch the various parts of the output of the date command. Here is my script: #!/usr/bin/perl -w use strict; my $date = system(date); $date =~ /(\w+)/; my $day = $1; print Day: $day\n; Here is my output: Thu Sep 8 10:22:14 CEST 2005 Day: 0 What is going on? Does this mean that

RE: catchDate

2005-09-08 Thread Charles K. Clarkson
Christopher Spears mailto:[EMAIL PROTECTED] wrote: : What is going on? Does this mean that nothing was : captured? Test it yourself. if ( $date =~ /(\w+)/ ) { my $day = $1; print Day: $day\n; } else { print Nothing matched.\n; } __END__ HTH, Charles K. Clarkson -- Mobile

Looping over an array of hashes problem

2005-09-08 Thread Graeme McLaren
Morning all, I have a problem that I can't see a way around. Basically I have an array of hashes and I want to get the key and value of each hash but with the following code I'm getting: Type of arg 1 to keys must be hash (not array element) at /usr/lib/perl5/vendor_perl/Purchaser/Common.pm

Re: catchDate

2005-09-08 Thread Ranish
On Thursday 08 September 2005 13:55, Christopher Spears wrote: I want to catch the various parts of the output of the date command. Here is my script: #!/usr/bin/perl -w use strict; my $date = system(date); $date =~ /(\w+)/; my $day = $1; print Day: $day\n; Here is my output: Thu

Re: catchDate

2005-09-08 Thread Le Sun (Sandy)
Why not use `date' directly?If you want to use perl indeed,how about this: #!/usr/bin/perl -w system(date \+Day: %d\); Christopher Spears wrote: I want to catch the various parts of the output of the date command. Here is my script: #!/usr/bin/perl -w use strict; my $date = system(date);

critique me script!

2005-09-08 Thread Christopher Spears
Can you critique my script, please? #!/usr/bin/perl -w use strict; #Automates pinging and checking a blade for the #nrnode. #Usage: checkDemon #Created by Chris Spears 9/7/05 version 1. while (1) { print Enter a blade number: ; chomp(my $bladeNumber = STDIN); my $blade =

RE: critique me script!

2005-09-08 Thread Thomas Bätzler
Christopher Spears [EMAIL PROTECTED] asked: Can you critique my script, please? If the options are alway numeric, you could use numeric comparisons instead of the match operator. That way, you would not have to chomp() the input because the == operator converts yout string to a number while

Re: Looping over an array of hashes problem

2005-09-08 Thread Jeff Pan
maybe u would try: foreach my $key (keys %{$AoH[$map_loop{$i}]}) { ... } because $AoH[$map_loop{$i}] is just a ref,so u get wrong. On Thu, 08 Sep 2005 09:42:33 +0100, Graeme McLaren [EMAIL PROTECTED] said: Morning all, I have a problem that I can't see a way around. Basically I have an

Re: catchDate

2005-09-08 Thread John W. Krahn
Christopher Spears wrote: I want to catch the various parts of the output of the date command. Is there something the date command can do that Perl's localtime(), gmtime(), POSIX::strftime(), etc. cannot do? perldoc -f localtime perldoc -f gmtime perldoc POSIX Here is my script:

Re: catchDate

2005-09-08 Thread Jeff 'japhy' Pinyan
On Sep 8, Christopher Spears said: I want to catch the various parts of the output of the date command. Here is my script: my $date = system(date); 1. system() does not RETURN the output of a command. 2. backticks -- that is, `...` -- return the output of a command. 3. Perl provides a date

Re: catchDate

2005-09-08 Thread John W. Krahn
Jeff 'japhy' Pinyan wrote: On Sep 8, Christopher Spears said: I want to catch the various parts of the output of the date command. Here is my script: my $date = system(date); 1. system() does not RETURN the output of a command. 2. backticks -- that is, `...` -- return the output of a

Re: catchDate

2005-09-08 Thread Gerard Robin
On Thu, Sep 08, 2005 at 01:25:18AM -0700 Christopher Spears wrote: I want to catch the various parts of the output of the date command. Here is my script: #!/usr/bin/perl -w use strict; my $date = system(date); with: my $date = localtime; woks fine. What is going on? Does this mean

%ENV

2005-09-08 Thread Gergely Buday
Hi there, why is the script #!/usr/bin/perl foreach $key (sort keys %ENV) { print $key=$ENV{$key}\n; } returns much less variable than $ set using bash? - Gergely -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

extract web pages from a web site

2005-09-08 Thread José Pedro Silva Pinto
Hi there, I am doing a program in perl to extract some web pages (And copy it to a local file), from a given web address. Which perl module can I use to help me to do this task Thanks José Pinto

Re: extract web pages from a web site

2005-09-08 Thread Jeff Pan
LWP::Simple can do that. On Thu, 8 Sep 2005 14:45:26 +0100, José Pedro Silva Pinto [EMAIL PROTECTED] said: Hi there, I am doing a program in perl to extract some web pages (And copy it to a local file), from a given web address. Which perl module can I use to help me to do this

Re: %ENV

2005-09-08 Thread John W. Krahn
Gergely Buday wrote: Hi there, why is the script #!/usr/bin/perl foreach $key (sort keys %ENV) { print $key=$ENV{$key}\n; } returns much less variable than $ set using bash? set is a bash built-in command which displays shell variables while the enviroment is independent

Re: %ENV

2005-09-08 Thread Nahalingam Kanakavel
hi, I think that it shows only the exported varaibles. I tried some thing like this ---try this-- 1) add one more variable with your own as prompt$ MY_OWN='name' 2) then run your program your variable MY_OWN will not be in the list but use suffix export infornt of the above line,

Re: catchDate

2005-09-08 Thread Binish A R
Christopher Spears wrote: I want to catch the various parts of the output of the date command. Here is my script: #!/usr/bin/perl -w use strict; my $date = system(date); $date =~ /(\w+)/; my $day = $1; print Day: $day\n; Here is my output: Thu Sep 8 10:22:14 CEST 2005 Day: 0 What is

array or hash ?

2005-09-08 Thread Gerard Robin
hello, In a array @tab I get $tab[n], but I don't know n. I want to get $tab[n + 1]. I found two ways (there are probably better ways;-)) 1: @tab = qw/bar tabou island mong turlut foo perl/; ($mot1) = grep /tu/, @tab; print $mot1, \n; $index = 0; foreach (@tab) { last if $tab[$index] eq $mot1;

Re: array or hash ?

2005-09-08 Thread John W. Krahn
Gerard Robin wrote: hello, Hello, In a array @tab I get $tab[n], but I don't know n. I want to get $tab[n + 1]. perldoc -q How do I find the first array element for which a condition is true John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

how to check real no. without including the package and stuff...........

2005-09-08 Thread mayank . ahuja
Mayank Ahuja Assistant System Engineer Tata Consultancy Services Limited Ph:- 044-5816 Cell:- 9283199460 Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com When every thing seems to be coming to ur way u r probably in the wrong lane. Notice: The information contained in this e-mail

Re: %ENV

2005-09-08 Thread Tony Frasketi
I've had problems with this in this the past and found your solution to work as long as I run my script from the bash command line. However if the script is run from a web page, I still do not get the value of the environment variable that I had set from the bash prompt or even in the

Re: %ENV

2005-09-08 Thread Wiggins d'Anconia
Please bottom post Tony Frasketi wrote: I've had problems with this in this the past and found your solution to work as long as I run my script from the bash command line. However if the script is run from a web page, I still do not get the value of the environment variable that I had

2-way lookup

2005-09-08 Thread Keenan, Greg John (Greg)** CTR **
Hi, I have a file like: A B C 1aa11bb11cc11 2aa22bb22cc22 3aa33bb33cc33 4aa44bb44cc44 I have two sets of coordinates like (A2, C1) and I need to join them together like aa22cc11 I am going to pull the relevent line for the

Re: 2-way lookup

2005-09-08 Thread Jeff Pan
#/usr/bin/perl my $i=0; my %hash; while () { chomp; s/^\s+|\s+$//g; $hash{$i}=[split]; $i++; } print $hash{0}-[0],\n; print $hash{1}-[2],\n; Is this useful? On Fri, 9 Sep 2005 12:11:33 +1000 , Keenan, Greg John (Greg)** CTR ** [EMAIL PROTECTED] said: Hi, I have a file

sendmail, etc.

2005-09-08 Thread Matthew Sacks
Greetings, I want to send mail from my perl code. (Boy, that's really unusual) I am thinking using mail::mailer. I need a bit more info than what I have so far found in the online documentation (perldoc -q mail). Where I can I find some advice? E.G., there is always an example of code that

Re: sendmail, etc.

2005-09-08 Thread Chris Devers
On Thu, 8 Sep 2005, Matthew Sacks wrote: Where I can I find some advice? This list isn't a bad place to start. E.G., there is always an example of code that defines a $to argument. but can $to be a list of addresses? (a group, that is). Can $to be a list of 100 email addresses? In

Re: 2-way lookup

2005-09-08 Thread John W. Krahn
Keenan, Greg John (Greg)** CTR ** wrote: Hi, Hello, I have a file like: A B C 1aa11bb11cc11 2aa22bb22cc22 3aa33bb33cc33 4aa44bb44cc44 I have two sets of coordinates like (A2, C1) and I need to join them together

Re: 2-way lookup

2005-09-08 Thread John W. Krahn
Jeff Pan wrote: #/usr/bin/perl use warnings; use strict; my $i=0; my %hash; while () { chomp; s/^\s+|\s+$//g; $hash{$i}=[split]; $i++; You could write those four lines as: $hash{$i++}=[split]; } print $hash{0}-[0],\n; print $hash{1}-[2],\n; Is this

RE: 2-way lookup

2005-09-08 Thread Keenan, Greg John (Greg)** CTR **
-Original Message- Hi, Hello, I have a file like: A B C 1aa11bb11cc11 2aa22bb22cc22 3aa33bb33cc33 4aa44bb44cc44 I have two sets of coordinates like (A2, C1) and I need to join them together like aa22cc11