On Fri, 15 Feb 2002, terri harrison wrote:

> If my input is in the form:
>
> Name: Happy, Species: Cat, Gender: Male
> Name: Peanut, Species: Hamster, Gender: Female
>
> how come
> foreach (keys %names) {
> if ($names{$_} =~ /\s*Gender:\s*$gen\s*/i) {
> AND
> if ($names{$_} =~ /\s*Species:\s*$sp\s*/i) {
>
> WORK
>
> why doesn't
> if ($names{$_} =~ /\s*Name:\s*$pn\s*/i) {

In what context?  What are you expecting them to do?  What are you doing
with the data?  Where are the variables $gen, $sp and $pn coming from?

Going by the two lines of data at the top, my first inclination would be
to break them up into key & value pairs and get them into a hash (using
splits, one to split onf commas, then on the :), then not even worry about
those regular expressions you are attempting.

-- Brett
                                          http://www.chapelperilous.net/
------------------------------------------------------------------------
Day of inquiry.  You will be subpoenaed.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to