in reply to Re: Using pattern match
in thread Using pattern match
If I try to run this:#!/usr/bin/perl -w # builtin triggers my %triggers; # add triggers from params my $trigger_name = shift @ARGV; my $trigger_action_str = shift @ARGV; my $trigger_action = sub { $trigger_action_str }; $triggers{$trigger_name} = $trigger_action; #print "$trigger_name -> $trigger_action_str\n"; my $buff = "You are fired!"; foreach my $trigger ( keys ( %triggers ) ) { if ( $buff =~ /$trigger/ ) { #print "Memory contents of \$1: $1\n"; print &{$triggers{$trigger}}; } } print "\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Using pattern match
by FunkyMonk (Chancellor) on Aug 10, 2007 at 12:26 UTC | |
by tceng (Novice) on Aug 10, 2007 at 13:57 UTC | |
Re^3: Using pattern match
by akho (Hermit) on Aug 10, 2007 at 14:15 UTC | |
by tceng (Novice) on Aug 10, 2007 at 14:50 UTC | |
by akho (Hermit) on Aug 10, 2007 at 15:46 UTC | |
Re^3: Using pattern match
by Anonymous Monk on Aug 10, 2007 at 14:37 UTC | |
by tceng (Novice) on Aug 10, 2007 at 15:21 UTC |