May be I am missing something obvious, but wouldn't a simple printf work ? (assuming there is only one variable needed).
Something like that :
#!/usr/bin/perl -w my %triggers = ( 'You are (\\w+).' => 'Your status is: %s', ); my $buff = "You are fired!"; foreach my $trigger ( keys ( %triggers ) ) { if ( $buff =~ /$trigger/ ) { print sprintf( $triggers{$trigger}, $1); } } print "\n";
In reply to Re: Using pattern match
by Anonymous Monk
in thread Using pattern match
by tceng
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |