Gossamer Forum
Home : Products : DBMan : Discussions :

printing if text exist

Quote Reply
printing if text exist
I'm trying to change dbman to print a text if a field contains a certain string.

I thought this string should do it:

if ($rec{'Description'} eq /Sugar/) {print qq|
<b>Warning:<b> sugar may be sweet!
|;
}

But doesn't print anything even if Sugar is in the field (among other ingredients, the field content may look like:

Flour``Sugar``Cream``Strawberry jam``etc).

What am I doing wrong?

(btw the warning text is essential: it will warn for ingredients dangerous if handled incorrectly. the sugar line above is only a place holder)

TIA

C.

Quote Reply
Re: printing if text exist In reply to

if ($rec{'Description'} =~ /Sugar/) {print qq|
<b>Warning:<b> sugar may be sweet!
|;
}

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: printing if text exist In reply to
Of course ...
Early mornings ....
Thanks!

C.