in reply to how to find hash keys in a string ?
Which results in:use strict; my %temphash = ( "tom" => "good", "dick" => "bad", "hary" => "ugly" ); my $temp = "This is a string containing tom and dick"; my $regexp = join('|',keys %temphash); print "Found: [$1]\n" while ( $temp =~ /($regexp)/cg );
Found: [tom] Found: [dick]
-- JaWi
"A chicken is an egg's way of producing more eggs."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: how to find hash keys in a string ?
by bart (Canon) on May 03, 2003 at 10:42 UTC | |
by Limbic~Region (Chancellor) on May 03, 2003 at 16:17 UTC | |
by Anonymous Monk on May 03, 2003 at 12:29 UTC | |
by bart (Canon) on May 03, 2003 at 12:50 UTC | |
by LordWeber (Monk) on May 03, 2003 at 16:20 UTC |