-Original Message-
From: Martin Moss [mailto:[EMAIL PROTECTED]]
Sent: 08 June 2001 15:15
To: [EMAIL PROTECTED]
Subject: Wildcard matching of hash keys
Has anybody done any work with wildcard matching of hash keys?
along the lines of
my $pattern=*red*;
if
First prize for a speedy response goes to Michael:-)
The goldfish in a bag is on it's way to you!
-Original Message-
From: Martin Moss [mailto:[EMAIL PROTECTED]]
Sent: 08 June 2001 15:15
To: [EMAIL PROTECTED]
Subject: Wildcard matching of hash keys
Has anybody done any
erskine, michael wrote:
Has anybody done any work with wildcard matching of hash keys?
along the lines of
my $pattern=*red*;
if (exists($hash{$pattern})) #I
{
print Key exists\n;
}
Ooh...ooh...let me!!!
my @hits = grep /.*red.*/, keys( %hash );
la-la-la! first
-Original Message-
From: Rubinow, Larry [mailto:[EMAIL PROTECTED]]
Sent: 08 June 2001 16:07
To: 'erskine, michael'; '[EMAIL PROTECTED]'
Subject: RE: Wildcard matching of hash keys
Well, sure ... but why not
my @hits = grep /red/, keys( %hash );
Ouch! I was stumbling my
At times I've thought it would be worthwhile to have a function called
regexists, that would look like this:
if ( regexists('cart','^302v') ) {
print hello\n;
}
Better yet, like the exists function:
if ( regexists $cart{/^302v/} ) {
grep works just fine for this
if (grep {/^305v/} keys