Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!apollo!carlton From: carlton@apollo.HP.COM (Carlton B. Hommel) Newsgroups: comp.lang.perl Subject: Bug in "$VER =~ /$foo/" when $VER contains "/" Message-ID: <5099c2f0.20b6d@apollo.HP.COM> Date: 26 Mar 91 20:09:00 GMT Sender: root@apollo.HP.COM Organization: Hewlett-Packard Apollo Division - Chelmsford, MA Lines: 33 The following program exhibits a bug. My workaround was to replace =~ with eq -- but that reduces the functionality. Invoke it without any options. The output I get with This is perl, version 4.0 $Header: perl.c,v 4.0 91/03/20 01:37:44 lwall Locked $ Patch level: 0 is "bl24" matches "" "02/05/91" nomatch "" Carl Hommel carlton@apollo.hp.com #! /usr/local/bin/perl require 'getopts.pl'; &Getopts('X:'); $VER = "bl24"; if ($VER =~ /$opt_X/) { print "\"$VER\" matches \"$opt_X\" \n"; } else { print "\"$VER\" nomatch \"$opt_X\" \n"; } $VER = "02/05/91"; if ($VER eq /$opt_X/) { print "\"$VER\" matches \"$opt_X\" \n"; } else { print "\"$VER\" nomatch \"$opt_X\" \n"; }