Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool2.mu.edu!sdd.hp.com!usc!apple!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!ccount From: ccount@athena.mit.edu (Craig A Counterman) Newsgroups: comp.lang.perl Subject: perl -s and -foo=23 or -bar-17 Summary: -s leads to the creation of variables with illegal names. Message-ID: <1991Jan12.073433.19925@athena.mit.edu> Date: 12 Jan 91 07:34:33 GMT Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 33 The -s option was recently brought to my attention, so I thought I'd try using it. I found that -foo defines $foo with the value 1, as advertised. I tried -foo=23, hoping that that'd give it the value 23 instead of 1. It didn't. It didn't define $foo either. However, it did remove '-foo=23' from @ARGV. I guessed that the variable 'foo=23' was created and given the value 1. This is a rather useless (inaccessable) variable! (a local perl (relative) expert just tought me how to access it through *baz, e.g. *baz = $_main{"foo=23"};print $baz; ) This is logical. But unhelpful, IMO. More helpful would be to (in order of increasing utility, in my opinion): 1) create $foo with the value 1 2) ignore -foo=23, leave it in @ARGV 3) create $foo with the value 23 Note that this is a more general problem, -bar-17 creates "bar-17", another inaccessable variable. And so on. -s leads to the creation of variables with illegal names. So (3) isn't sufficient by itself to deal with all such cases. So, what if anything can be done? Note this in the man page under -s behaviour? I'm anxious to get a copy of the Book. I've gotten so much excellent use from perl in the past year (exactly, now that I think of it), and still find that I use about 40% of the language. Thanks, Craig becoming Lazy, Impatient, and Proud.