CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [GreetzFromWIT] Recognition of numbers: Edit Log



FishMonger
Veteran / Moderator

Sep 1, 2015, 9:33 AM


Views: 10986
Re: [GreetzFromWIT] Recognition of numbers

In the past I often used complex constructs like your conditional as a means to minimize the code. In doing so, occasionally it would come back to bite me with bugs which were difficult to troubleshoot, much like as is in this case.

I now put readability and maintainability above code brevity which has greatly reduced the amount of bugs in my code. Let perl golf and obfuscation be in the fun and "show off" code, not production code. :)

Since you're doing this in a loop, one way to fix the bug and keep it brief and readable and maintainable would be to do it this way.

Code
next unless exits $params_in->{resolve_until_release} 
and defined $params_in->{resolve_until_release}
and $params_in->{resolve_until_release} =~ m/^(\d{4})\-(\d{2})$/;



(This post was edited by FishMonger on Sep 1, 2015, 9:47 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Sep 1, 2015, 9:45 AM
Post edited by FishMonger (Veteran) on Sep 1, 2015, 9:46 AM
Post edited by FishMonger (Veteran) on Sep 1, 2015, 9:47 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives