in reply to build regular expression from scalar?

You could even do something like this:

# Figure out what actions the user wants to monitor. my $monitored_actions = join "|", @ARGV; # Create a monitoring RE that can be used again and again # without re-compiling it. my $monitor = qr/$monitored_actions/; { # Decide what action to take. my $action = ('ADD', 'REMOVE', 'DELETE', 'QUIT')[rand(3)]; # And here we monitor it. $action =~ /$monitor/ && do { print $action, "\n"; }; redo unless $action eq 'QUIT'; }

Then run it from the command line like this:

./mytest ADD REMOVE

TI(always)MTOWTDI


Dave


"If I had my life to live over again, I'd be a plumber." -- Albert Einstein