Replacing variables with numbers from a list
Posted: Mon Jun 13, 2005 3:30 am
I'm wondering if it would be possible to replace a variable with a value from a list of numbers. The catch being that as each new 'Find' is found the 'replacement' will be the next value on a list. This is what I want to do.
Turning this:
To this:
I want the XX variable to change from 1 to 2 to 3 etc. as each new 'find' occurs. And I want the A,B,C and D variables to be 'replaced' by a number from a NotePad file that would be formated as a list. I have to do this 150 times. That would take time. That would be 600 numbers I have to manually insert. I don't want to do that all manually. Is this possible using this program?
Turning this:
Code: Select all
elsif ($item_total_weight <=XX) {
$ship_total_1 = A;
$ship_total_2 = B;
$ship_total_3 = C;
$ship_total_4 = D;
} elsif ($item_total_weight <=XX) {
$ship_total_1 = A;
$ship_total_2 = B;
$ship_total_3 = C;
$ship_total_4 = D;
}
Code: Select all
elsif ($item_total_weight <=1) {
$ship_total_1 = 1;
$ship_total_2 = 11;
$ship_total_3 = 22;
$ship_total_4 = 33;
} elsif ($item_total_weight <=2) {
$ship_total_1 = 2;
$ship_total_2 = 12;
$ship_total_3 = 23;
$ship_total_4 = 34;
}