Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!clyde.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: untainting data Message-ID: <11446@jpl-devvax.JPL.NASA.GOV> Date: 15 Feb 91 01:05:42 GMT References: <18@sysadmin.sysadmin.com> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 24 In article <18@sysadmin.sysadmin.com> bjorn@sysadmin.sysadmin.com (Bjorn Satdeva) writes: : I have a problem with untainting data. Larry examples in the manual and : book is not sufficient, as I need all alfa-numeric plus the '-'. : : Currently the code looks like this (which seems to lack somewhat in : generality :-): : : ------------ : : $ARGV[ 0 ] =~ /^(\w+)*$/; : $Addr = $1; : : # The above does not work for '-' -- sigh : if ( $ARGV[ 0 ] eq 'sysadm-list' ) { : $Addr = 'sysadm-list'; : } I'd change that to /^([-\w]+)$/. The - has to come first or last in [] or else it's interpreted as a range. (You can also use \- to hide it.) Incidentally, Bjorn, I tried replying to your email a while ago and it bounced. I'd be happy to present Perl to your group. Larry