Solved

compile patten once, use elsewhere

Posted on 2002-07-15
1
137 Views
Last Modified: 2010-03-05

Have outloop pattern I want compiled in the outer
loop and used in innerloop.

foreach $o (@oa) {
  # pattern /^$o\d\d$/
  foreach $i (@ia) {
    # use it here  $i =~ /fromOuterLoop/;
  }
}

How?

Thanks
 
0
Comment
Question by:hank1
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 50 total points
Comment Utility
foreach $o (@oa) {
    $pattern = qr/^$o\d\d$/;
    foreach $i (@ia) {
       $i =~ $pattern;
    }
}
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now