in reply to Re^3: Using pattern match
in thread Using pattern match

Thanks for your feedback, it's very interesting and appreciated.
The script will run as server and therefore I'd like it to tun in tainted mode, so I figured out another way to do things:
#!/usr/bin/perl -w -T use strict; # builtin triggers my %triggers; # add triggers from params my $trigger_name = shift @ARGV; my $trigger_action_str = shift @ARGV; $triggers{$trigger_name} = $trigger_action_str; my $buff = "You are fired!"; foreach my $trigger ( keys ( %triggers ) ) { if ( $buff =~ /$trigger/ ) { my $c1 = $1; my $txt = $triggers{$trigger}; $txt =~ s/\$1/$c1/g; print $txt; } }
Yes, that's not elegant for I should save each memory container $1, $2, and so on to be general enough, but at least I can run it in tainted mode:
perl -T triggers4.pl "You are (\w+)." "Your status: $1"

So I get:
Your status: fired

Cheers,
tceng