I think eval can help you... See perldoc -f eval.
Kenton Brede wrote: > I've done some searching and can't find an answer to this. I'd like > to use a scalar variable in an array name. Something like "@$scalar" > I've tried different permutations like "[EMAIL PROTECTED]", "@"$scalar"" > "@\$scalar" and none of them work. > > What I'm trying to do is come up with a way to slurp ARGV variables in > and if a match is found in @list, then print out the matching array, > either @rhel or @all. The following code is an example. > Thanks for any help, > Kent > > ----------------------------------------------------------------------- > #!/usr/bin/perl > use warnings; > use strict; > > my $first_arg = "$ARGV[0]"; > my @list = ("all", "rhel"); > my @rhel = ("server1", "server3", "server4"); > my @all = ("server2", "server5", server7"); > > foreach my $list_name (@list) { > if ( $list_name eq $first_arg ) { > print "@$first_arg"; > } > } > ----------------------------------------------------------------------- > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>