I use ‘variables’ with names consisting of a number of characters strings separated by ‘_’.For example $pear_apple_peach and $pear_damson_orange.I would like to be able to refer to each character string section of the particular variable I want to use with other variables.For example if I had three variables called $ch1, $ch2 and $ch3 then when these were
$ch1 = ‘pear’; $ch2 = ‘apple’; $ch3 = peach – I want to use $pear_apple_peach.
I know I can do this with a series of ‘if’ statements but I wondered if there was a more flexible and general way.
For example is there something like $<$ch1_$ch2_$ch3> which would mean I can access the variable ‘defined’ by what is between the ‘< >’ characters OR something else that would equally do what I want?