On Fri, Jan 03, 2003 at 03:33:30PM -0800, John W. Krahn wrote:
> Paul Kraus wrote:
> > 
> > Ok a couple questions on Ref from pg 251 programming Perl.
> > 
> > push @$arrrayref,$filename);
> > $$arrayref[0]="January";
> > @$arrayref[4..6]=qw/May June July/;
> > 
> > So this is actually creating an anonymous array that it then references
> > correct?
> > so the assignments January ect are being made to an anonymous array.
> 
> No, an anonymous array is delimited by [ and ].  That is creating an
> actual array that is only accessible through an array reference.
> 
> my $ref = [ 1, 2, 3, 4, 5 ];
>           ^^^^^^^^^^^^^^^^^
>            anonymous array

Not worth picking a fight over, to be sure, but I don't see the
difference.  Assuming $arrayref didn't exist before, then after each of
those three examples it will, and it will be a reference to an array
with no name.  Seems to me that Paul got it spot on.

> > I have seen them used to simulate a multidimensional array as well has
> > hash and that makes sense. But beyond that I am kind of at a loss.
> 
> If you are used to data structures in other languages then you may find
> Perl's data structures pretty limited (I know I did :-).)  However
> Perl's other features more then make up for this.

I'm not quite sure what to make of that either.  Which languages and
data structures are you comparing against?  In a language like C, you
have to build everything yourself.  In C++ you might use the STL, but I
think you'd have to compare that against CPAN to be fair.  It is, of
course, quite possible to build ADTs in Perl - it just seems to be less
necessary, as you note.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to