in reply to Script for a URL that constantly changes
Define use...
Where it says $sku, that will change constantly via a databaseThen you probably want to interact with the database in any way: use DBI
my @sku = ('CODE TO THE DATABASE')Good try...
my %code = 'CODE TO SOLVE YOUR PROBLEM HERE'; ;-)Aha, question updated with some real code, let's see...
looks like a work for a hash... my @sku = ('NUMBER') is not what you want probably; first of all because @ mean a list of elements, not a single number, and also because a %hash is much better here. If you define @sku as an array you could have by mistake the same number for two products (and this is a BIG problem), but a hash will not permit you to do this. The number $sku is the key (unique) and the catalog ref is the value.
so the first thing that you should try to fix is these two lines.
my @sku = ('NUMBER'); for my $sku (@sku) {...
Instead connect to the database and prepare something like: select field2 for mytable where field1 = ? and fill the gap with the correct number sku with execute($sku). Read the manual of DBI for the details
finally when you have your hash you could write something like this
https...partnumber=$sku...catalog_number=$hash{$sku}&inE=1&highlight...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Script for a URL that constantly changes
by semrich (Initiate) on Oct 20, 2011 at 15:52 UTC |