- Original Message -
From: "Gibbs Tanton - tgibbs" <[EMAIL PROTECTED]>
To: "'HANSON '" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, November 10, 2001 8:06 AM
Subject: RE: basic pattern matching
> You can look at perld
On Fri, 9 Nov 2001, HANSON wrote:
> I am traversing a multidimensional hash searching for a value and
> trying to delete it. However, I am ending up deleting the wrong one.
> The value I'm looking for is /name/. There is also a value of /name1/
> in the hash. When I use =~/name/ it deletes the na
Hi,
> where ^ matches start of string
> and where matches end of string
Should be "and where $ matches end of string.
Jonathan Paton
__
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music
Charts
ht
Hi,
The problem reduced to a level I can solve:
Match "name"
but not "name1" etc
Solution:
Use ^ and $ assertions
where ^ matches start of string
and where matches end of string
hence use /^name$/
Hope that is clear enough :)
Jonathan Paton
__
By adding a ^ - anchor at beginning and $ anchor at end:
/^name$/# must be name
/^name/ # must start with name
/name$/ # must end with name
Wags ;)
-Original Message-
From: HANSON [mailto:[EMAIL PROTECTED]]
Sent: Friday, Nov
One way is that you can use eq instead of =~. If there is a reason you
can't use eq then you can use /^name$/. That will cause it only to match
the string name. BTW, eq does an exact string match while =~ does a pattern
match.
To illustrate the difference, consider the following lines
print "