gnetcon
08-25-2006, 01:57 PM
Everyone:
I admittedly come from a PHP background, and am trying to convert a script in PHP to run in Perl. I have it all running, except for one piece.
In my code, I loop through a MySQL query to create RSS files for items in a database. Everything works great. But in my PHP code, I also created a RSS file for each state with items that belonged to it. So my array may look like:
$arrStates["md"][0]["lid"] = "Name"
$arrStates["md"][0]["title"] = "Title Here"
$arrStates["md"][1]["lid"] = "Name #2"
$arrStates["md"][1]["title"] = "Title #2 Here"
$arrStates["de"][0]["lid"] = "Name"
$arrStates["de"][0]["title"] = "Title Here"
$arrStates["de"][1]["lid"] = "Name #2"
$arrStates["de"][1]["title"] = "Title #2 Here"
I did that by doing:
$arrStates[$state][] = array("lid" => "Name", "title" = "Title Here");
What is the best way to do this in Perl? Should I have a hash (%arrStates{$state}) that I push an array onto? Or is this nonsense? Is there a better way to do it?
TIA!
I admittedly come from a PHP background, and am trying to convert a script in PHP to run in Perl. I have it all running, except for one piece.
In my code, I loop through a MySQL query to create RSS files for items in a database. Everything works great. But in my PHP code, I also created a RSS file for each state with items that belonged to it. So my array may look like:
$arrStates["md"][0]["lid"] = "Name"
$arrStates["md"][0]["title"] = "Title Here"
$arrStates["md"][1]["lid"] = "Name #2"
$arrStates["md"][1]["title"] = "Title #2 Here"
$arrStates["de"][0]["lid"] = "Name"
$arrStates["de"][0]["title"] = "Title Here"
$arrStates["de"][1]["lid"] = "Name #2"
$arrStates["de"][1]["title"] = "Title #2 Here"
I did that by doing:
$arrStates[$state][] = array("lid" => "Name", "title" = "Title Here");
What is the best way to do this in Perl? Should I have a hash (%arrStates{$state}) that I push an array onto? Or is this nonsense? Is there a better way to do it?
TIA!