in reply to Store regular expressions in a file.
You could eval the code into existence. People decry it, but it is one thing that makes dynamic languages so powerful:
#!/usr/bin/perl use strict; use warnings; my $data = "duck"; while(<DATA>) { chomp; my $code = eval "sub{ \$_[0] =~ $_ }" // die $@; if( $code->( $data ) ) { print "$data\n"; } } __DATA__ s/duck/luck/
Produces:
c:\test>junk02 luck
|
|---|