Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2016-09-30 15:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (569 votes). Check out past polls.