http://www.perlmonks.org?node_id=484599

beeconn66 has asked for the wisdom of the Perl Monks concerning the following question:

hello,
let me first say i'm new to perl and pattern matching as well, so this may be a dumb question.
I was wondering if i can pattern match a record which contains variables. Its kind of hard to explain what i mean so let me give an example.
Say i have an employee record of first name, last name, and employee #. in the from

employee(firstname, lastname, soc)

based on that record i want to do pattern matching to see if it meets specific requirements. Requirements that may change in the future. With that being said, is there some way to declare valid patterns for first name, last name, and employeenum.

For example

firstname = [\w]{1,100} lastname = [\w]{1,100} employeenum = [\d]{1,100}

I think what i am asking is there a way to declare a regular expression as a variable?

Does any of this make sense to anyone? Your thoughts/suggestions are appreciated.

20050817 Janitored by Corion: Added formatting