
rmh_va
Novice
Aug 17, 2011, 12:21 PM
Post #27 of 32
(1842 views)
|
|
Re: [FishMonger] anyone OTHER THAN FISHMONGER know how to interpolate variable names in a loop?
[In reply to]
|
Can't Post
|
|
your solution did not work... I gave you a code snippet to run, and you were unable to get it to work, and didn't understand it... All, please disregard Fishmongers comments... He has made this entire process (tyring to get a solution on this forum) a nightmare... He obviously doesn't have the first clue what I'm looking for, and won't admit this... What I'm trying to do is field several perl variables in a loop... It'd be better if I had an array or a hash, I'd love that... but it is what it is.. code is provided that poduces these variables... I am attemting to process them in a loop... I asked for help processing them in a loop, using tnterpolation to append the number at the end... no one had any suggesitons that worked... I provided source, still no solution.... here's the code: I orignially asked if anyone knows how to fix my interpolation problem... here's the code... I have 8 variables... I would like to reference them in a loop without hard-coding the names... $sub1 = 'var1name/var1text'; $sub2 = 'var2name/var2text'; $sub3 = 'var3name/var3text'; $sub4 = 'var4name/var1text'; $sub5 = 'var5name/var1text'; $sub6 = 'var6name/var1text'; $sub7 = 'var7name/var7text'; $sub8 = 'var8name/var8text'; print '<table>'; while ($i < 9) { $temp = "$sub.$i"; @xr = split("/",$temp); print '<tr><td>',$xr[0],'</td><td>',$xr[1],''; $i++; } print '</table>'; I want to fix this statement: $temp = "$sub.$i"; I can't get the split to work with a variable name that's interpolated... so I made an assign stantement, just to see if I could interpolate and assign the variable another way... no luck... can anyone out there make this code work? NOTE : Changing the variables the way they are passed is not an option... It's embedded in a client module, can't change it... So it's going to pass me 8 variables, as noted above... thanks, and if you don't have specific knowledge to bring to bear on this issue, kindly exit without comment...
|