Adam Saeed wrote:
hi i am some new to per;.
I want to get a day numbers by year and store them in e a 2 -d array,
getting data from mysql. i.e data[dayofyear][year] ....BUT I COULD NOT
GETTING THE DESIRE RESULT ... ANY HELP my snap code is:
...
...

@year  #have list of years
my $i=0;
my @dayofyear=([],[]);
my @data=([],[]);
my $old;
for $i (0 .. $yrtot)
{
$old = $dbh->prepare("SELECT
distinct(dayofyear(from_unixtime(datetime))) FROM table where
year(from_unixtime(datetime))='$year[$i]'");
  $old->execute();
  while (@dayofyear = $old->fetchrow_array())
        {
         push (@data,@dayofyear);
This is not clear
Do you want @data to contain the 2-D result?
Then use
$data[$year[$i]] = [EMAIL PROTECTED]
   ( your push will create only a 1-D array not a 2-D )

You will get @data to be an array of
      $data[year][dayofyear]
and not
       $data[dayofyear][year]

I think this is what you would want
Use dumper to help you see the array. To visually see your data put a debug statement like


use Data::Dumper;
print Dumper([EMAIL PROTECTED]);



HTH
Ram

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to