in reply to Re: Variable being saved as a list?
in thread Variable being saved as a list?

Sorry, as I said I am new to this. The variable I am having a problem with is $shipcountry, the variable $discnt works fine. I am trying to update $shipcountry via a form. It starts as "none" and I want it to change to whatever country is entered but what I end up with is, for example, "none, United States, Canada, United States" the number in the list depends on how many times you try and submit a change. I am not sure how I can make a self contained example but I will try.

Replies are listed 'Best First'.
Re^3: Variable being saved as a list?
by Anonymous Monk on Aug 06, 2014 at 19:18 UTC
    Sorry, as I said I am new to this.

    No problem, we're here to help. Pages such as "How do I post a question effectively?" are there to help people asking questions help the people answering them (despite their sometimes slightly patronizing titles).

    I suspect the problem actually lies with the code that sets $shipcountry in your script. Are you using some kind of library to handle the input from the form? If so, I'd also look there for how it handles $shipcountry and why it might be appending the values.

    A note on terminology for the future: A "list" in Perl is actually not what you've got with $shipcountry, that's a scalar (a single value) that contains a string (which happens to contain commas).

      Thanks, I managed to get it working, there was some code at the bottom of the script that was causing it to do funny things with variables it didn't recognize. Thanks for the help.