Hi, Randall! :)

(BTW, great book. :-D  In case you hadn't been told enough!)

On 13 Sep 2001 [EMAIL PROTECTED] wrote:

> >>>>> "Bob" == Bob Showalter <[EMAIL PROTECTED]> writes:

> Bob> perl -e '-f $_ || print "Missing $_\n" for map {/^(.*)\.c$/; "$1.out"}
> Bob> @ARGV' *.c

> No.  You've used $1 without verifying the match matched (in which
> case it would get the PREVIOUS match).  For example, I can touch
> "foo\nbar.c" and run your script, and you'll get the wrong answer.

What's wrong with this?  Note that he's passing the *.c glob, so you'd
expect to only find .c files in @ARGV, right?  And if there're no *.c
files in the current directory, then the script just prints nothing.
Isn't that the correct behavior?

> IMPORTANT RULE - Never ever ever use $1 except in a conditional
> context!!!

That makes sense if you don't feel completely confident about your
inputs... but all the time?

---Jason


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to