Dec 22, 2010, 9:49 AM
Hello. I'm a novice Perl programmer (if it wasn't clear from where I posted) who has been tinkering around with the language for a couple months on and off and just starting getting into wxPerl. I'm liking Perl quite a bit, but I have a few questions.
A few basic questions (mostly related to GUIs and parsing)
1) What's the best way to parse a string as a hexadecimal number and vice-versa? For example, say the user puts in "3C" or "0A7F" as arguments in a command-line program. How do I tell the program to treat those as numbers rather than character sequences? For going the other way around, I assume I can use printf; I've done it that way before, although I'm not sure how well it would work with things like text boxes and labels.
2) Are there any good tutorials for wxPerl? I've searched on Google and all, and I haven't found a one that is actually complete. (I could say the same for GUI programming in other languages as well, such as C++, but this is a Perl forum, after all.) The few I found covered only the first few steps, not to mention they didn't seem to do a very good job of explaining exactly what each element of the program does. I couldn't find much in the way of documentation for the widgets, either. (For instance, I have a program in mind that requires text boxes and checkboxes, and I found no information about either.) Where might I find some good tutorials and documentation?
3) What's the best way to remove any of a certain list of characters from the beginning of a line of text and from the end, or from a certain character onward? It's kind of hard to explain, but I feel like I'm missing something simple here, especially with that subroutine in the FAQ that removes all whitespace from the beginning and end of a string. For example, say I'm parsing a line of assembly code. It may or may not have whitespace characters at the beginning, it may or may not have whitespace characters after the code, and it may or may not have a comment beginning with a semicolon, which could contain any alphanumeric characters. I'd need to disregard everything after any semicolon and any whitespace characters that aren't within the code itself. Is there a way to do that in only, like, one or two steps? I can see it being easily possible with a series of split statements and the like, but when I tried it, it seemed to take more code than I would think would be necessary for such a task in Perl.
If anyone could answer my questions (providing extra information if necessary), I would appreciate it. I will use this thread for more questions in the future when I have them (and believe me, I will).