On Mon, Apr 7, 2008 at 12:20 AM, Richard Lee <[EMAIL PROTECTED]> wrote:
> I just read FAQ on finding out yesterday's time.
>
>  I see that one of the easy way to find out is
>
>  my $date = scalar localtime( ( time() - ( 24 * 60 * 60 ) ) );
>  print "$date\n";
>
>  and it works fine for me
>
>  I also see lot of modules that will make life easier for beginners.. but
> since I was learning reference, I wanted to try this on my own
>  since Leap year is not a huge factor, so
>
>  my @Jan = (1..31);
>  my @Feb = (1..29);
>  my @Mar = (1..31);
>  my @Apr = (1..30);
>  my @May = (1..31);
>  my @Jun = (1..30);
>  my @Jul = (1..31);
>  my @Aug = (1..31);
>  my @Sep = (1..30);
>  my @Oct = (1..31);
>  my @Nov = (1..30);
>  my @Dec = (1..31);
>
>  my @cal_r = [ @Jan,@Feb,@Mar,@Apr,@May,@Jun,@Jul,@Aug,@Sep,@Oct,@Nov,@Dec
> ];
>

take another look at perldoc perlref. what you've created, here, is a
an array (@cal_r) whose single element is an anonymous array with 365
elements. Since Perl arrays are zero-indexed, if you examine $#cal_r,
you'll see that it is '0'

You probably meant something more like

my $cal_r = [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED];  #etc.

But see the perlref and perlreftut for more info.

Once you get the references sorted out, the logic should be come
clearer, but your instinct to rewrite using hashes is probably a good
one.

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org

values of β will give rise to dom!

Reply via email to