Just another Perl shrine | |
PerlMonks |
Re: Regex, the jungle survival skillby kcott (Archbishop) |
on Mar 10, 2016 at 07:22 UTC ( [id://1157264]=note: print w/replies, xml ) | Need Help?? |
G'day mmkstarr, Welcome to the Monastery. "I am wondering how far one can get in pearl without learning regex?" [Note: the language is called Perl and the program is called perl. A "pearl" is something you'll find in an oyster.] Perl provides much the same constructs as other programming languages. (See "perlintro -- a brief introduction and overview of Perl".) You can write Perl code without using regexes. However, unless you're coding in total isolation, you will often encounter regexes in code written by others: without being able to understand regexes, you won't get very far. As an absolute bare minimum, I suggest you read, and fully comprehend: "Is regex fluency a huge boon to a perl user?" The short answer is: "Yes". Regexes allow you to write very succinct code, often in a single line, which otherwise would require dozens, or even hundreds, of lines of code to accomplish. Having said that, it's important not to fall into the trap of always reaching for a regex just because it can be used. Perl provides a number of functions and operators which may be more appropriate than a regex and, more often than not, are much faster than the equivalent regex. Here's some examples:
"If so, what are some of the best regex tutorials you have come upon?" In the first instance, I suggest you look at: There's a lot of documentation on Perl's regular expressions. Use the following, as required, for reference:
— Ken
In Section
Seekers of Perl Wisdom
|
|