On Tue, Apr 8, 2008 at 6:21 PM, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> From: "Jay Savage" <[EMAIL PROTECTED]>
> > 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.
>
> It's possible to write that as
>
> my @cal_r =
> \(@Jan,@Feb,@Mar,@Apr,@May,@Jun,@Jul,@Aug,@Sep,@Oct,@Nov,@Dec);
>
> I find this syntax a bit confusing, but it will prevent you from
> having to put a backslash before each month's array.
>
> Jenda
Not quite.
my $ref = [EMAIL PROTECTED], [EMAIL PROTECTED];
creates a scalar as reference to an anonymous array, each of whose
elements is an arrayref.
my @array = \(@array1, @array2);
creates an array, each of whose elements is an arrayref.
In some cases, the second option may be more desirable, but they
aren't interchangeable:
my @array1_copy1 = @{$ref->[0]}; # arrayref of arrayrefs
my @array1_copy2 = @{$array[0]}; # array of arrayrefs
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!