I'm trying to use this URL

Define use...

Where it says $sku, that will change constantly via a database

Then 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...

In reply to Re: Script for a URL that constantly changes by pvaldes
in thread Script for a URL that constantly changes by semrich

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.