Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
As some of you may know, I've been grappling with using RE's (which I really prefer to use) in code rather than conditionals which are much easier to read (but ten times slower).
I have come up with a neat idea that I thought would simplify my code, and also still allow me to use regular expressions. Rather than having one 60 character RE handle things, I can break stuff down into smaller RE's and put them in an array and then iterate over them. So while I am not using the full extent of the RE engine, I am also not making perl do backflips for conditionals -- and all my co-workers will be able to read it (because theyre small and simple). So an example of this is the following sub: Note how cool those qr!!'s line up and are easily readable by almost anyone (yeah I'm proud of myself. *grin*). However, the test is evaluating true every single time, even when there is no reason it should be. When I print them out, I get an array ref, which does seem odd since that would seem to me to resemble this: rather than what it really is, above. So I'm sure I am missing something stupid here, and I'd really like to use this construct since it seems like such a magical silver bullet for my readbility vs. speed dilemma.
thanks
--
|
|