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
--- 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
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
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,
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
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
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
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
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);
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 =
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
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
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:
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
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
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
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/
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
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
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
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,
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
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;
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
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
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
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
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
#/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
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
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
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
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
-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
34 matches
Mail list logo