mardi 25 juillet 2017

setting variable name with variable at the end - perl

foreach (@products) {
$id = 1;
$productid = param('product$id');
++$id;
}

I am trying to loop through the products array and create a new variable for each item in products for a form which uses checkboxes to select products which are for sale. I tried to use $productid$id and $productid"$id" but it returned syntax errors. Is there a way to achieve this?




Aucun commentaire:

Enregistrer un commentaire