Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: <p>string variable</p>

by hdb (Prior)
on Jul 24, 2013 at 10:45 UTC ( #1046065=note: print w/ replies, xml ) Need Help??

in reply to <p>string variable</p>

I am not sure about the wisdom of your undertaking but this is how you could be doing it (if I understand the question correctly...):

use strict; use warnings; my @array = ('A1', 'A2', 'A3', \$1, '$2'); my $message = 'If you choose a yellow car everyone will follow you!'; my $my_trigger = 'If you (.*) a (.*) car (.*) will follow you!'; if ($message =~ m/$my_trigger/g) { my $option = ${$array[3]}; my $color = $2; my $whom = $3; print "option: " . $option; print "\ncolor: " . $color; print "\nwhom: " . $whom; }

Comment on Re: <p>string variable</p>
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1046065]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-12-29 05:50 GMT
Find Nodes?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?

    Results (184 votes), past polls