[Chicago-talk] Using a hash in a regex
Jonathan Rockway
jon at jrock.us
Thu Jul 13 14:27:13 PDT 2006
OK, just wanted to make sure I wasn't missing something (since it was
m/// in the original question too). I don't usually use s/// in
non-void contexts, so the $foo = m/// doubly threw off my mental parser
:) Now, rereading it, it all make sense :)
Regards,
Jonathan Rockway
Andy Lester wrote:
> On Jul 13, 2006, at 4:17 PM, Jonathan Rockway wrote:
>
>
>> I'm confused as to what the "two-argument" form of m// is. Am I
>> missing
>> something?
>>
>>
>>> No, you have to loop manually.
>>>
>>> for my $key ( keys %h ) {
>>> if ( m/$s/$key/ ) {
>>> $n = $h{$key};
>>>
>
> ooops I meant $s =~ /$key/
>
> The other thing is that if you're not using regex characters, Jay,
> then use index() instead of the regex. If you're searching for the
> string "income" then don't go thru a regex to do it.
>
> --
> Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance
>
>
>
>
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
More information about the Chicago-talk
mailing list