Amblikai has asked for the wisdom of the Perl Monks concerning the following question:
I was knocking up some code today and i figured this was an interesting question for you guys
Essentially, i was wondering if it is possible to have subroutine references/calls inside a regexp? For example, subs that return a precompiled part of the regexp?
In other words, in entirely made up Perl, is this possible?..
#!/usr/bin/perl -w my $string="more than one part\nanother sentence more than"; sub getone {return qr/(more)/;} sub gettwo {return qr/(than)/;} my @array=$string=~/(\s&getone\s&gettwo)/g;
Obviously i've tested that and its nonsense, but is there a similar approach?
Thanks!
Back to
Seekers of Perl Wisdom