Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Detect * in argumentsby kennethk (Abbot) |
on Jul 10, 2015 at 18:03 UTC ( [id://1134208]=note: print w/replies, xml ) | Need Help?? |
Code is worth 1000 words; please include input, output and code (or pseudocode) for future questions. See How do I post a question effectively?
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 using If these don't fit the bill, provide more algorithmic clarity, and I can be more helpful. 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.
In Section
Seekers of Perl Wisdom
|
|