Path: utzoo!attcan!uunet!cs.dal.ca!nstn.ns.ca!bonnie.concordia.ca!s3!gamin From: gamin@ireq-robot.hydro.qc.ca (Martin Boyer) Newsgroups: comp.lang.perl Subject: Comparing numbers and regular expressions Message-ID: <5152@s3.ireq.hydro.qc.ca> Date: 1 Feb 91 20:29:00 GMT Sender: root@s3.ireq.hydro.qc.ca Organization: Laboratoire de robotique, Institut de recherche d'Hydro-Quebec Lines: 27 I'm trying to compare a numeric user id against a list of numbers. Here's my attempt; it doesn't work, possibly because the regular expression search doesn't treat the numbers as strings: $uid_list = "13|1"; $this_uid = 101; if ($this_uid =~ /^$uid_list$/o) { print "Matches!\n"; } else { print "Doesn't match.\n"; } This section prints Matches!, but that's not what I want; what I want is for the test to succeed only for values of 13 or 1. Can anybody enlighten me? Thanks, -- Martin Boyer mboyer@ireq-robot.hydro.qc.ca Institut de recherche d'Hydro-Quebec mboyer@ireq-robot.uucp Varennes, QC, Canada J3X 1S1 +1 514 652-8412