troubleshooting Question

Array in a hurry

Avatar of Dan-LL
Dan-LL asked on
PerlScripting Languages
6 Comments1 Solution201 ViewsLast Modified:
getting late here in UK, got to have this done before I can go to bed, lol...

Could someone tell me how to do this better with an array or something, new to perl but under presure to get this done for a friend.

if ($sndteam eq "1") {$sndteam = $onename};
if ($sndteam eq "2") {$sndteam = $twoname};
if ($sndteam eq "3") {$sndteam = $threename};
if ($sndteam eq "4") {$sndteam = $fourname};
if ($sndteam eq "5") {$sndteam = $fivename};

can it be looped through in an array, the "digit" number changes 1 to 5 and the $[number]name changes one to five.

Many thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros