in reply to Re: find module name from the module archive
in thread find module name from the module archive
Thanks for the suggestion. I do prefer to avoid having to use $1 for just trimming some characters. My regex worked for what I needed to do and since I'm only running this on 15 to 20 strings I wasn't worried about optimization. I find that other people's regexes are usually hard to read at first. I'm curious why you say mine is inefficient. Did you do some benchmarking?
In your regex ( $module =~ s/\-[^-]*$//; ) the backslash isn't needed for a '-'.
Rule of thumb: Try to make all your patterns start with a character and not a wildcard.
I was just reviewing the regex documentation and I didn't see that one listed. There are a lot of examples however where they don't start with a character. Are you including character classes as characters?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: find module name from the module archive
by shawnhcorey (Friar) on Dec 21, 2016 at 19:51 UTC |