Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re:

string variable

by daxim (Chaplain)
on Jul 24, 2013 at 10:59 UTC ( #1046072=note: print w/replies, xml ) Need Help??


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

You're asking about varvarnames. Read that article and the following ones to understand why we can't recommend that.

Instead just use a hash!

my @slots = qw(option color whom); my $message = 'If you choose a yellow car everyone will follow you!'; my $my_trigger = qr/If you (.*) a (.*) car (.*) will follow you!/; my %hash; if (@hash{@slots} = $message =~ /$my_trigger/) { for my $slot (@slots) { print "$slot: $hash{$slot}\n"; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1046072]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2016-12-03 06:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (52 votes). Check out past polls.