in reply to Detect * in arguments
Finding out whether a string contains a certain character can be done with index or regular expressions. In your case, maybe your check would look like:
or maybe you'd strip it usingif (index($args, '*') != -1) { die "No * are allowed.\n" }
If these don't fit the bill, provide more algorithmic clarity, and I can be more helpful.$args =~ s/\*//g;
Update: Or do you mean the shell is expanding the '*' metacharacter before it gets fed to your code? In this case, your code never sees the asterisk, and the hassle in protecting the user from themself is almost assuredly not worth your time.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|