[Pdx-pm] array question

Ovid poec at yahoo.com
Mon Apr 21 14:40:31 CDT 2003


Hi Annett;

> I am using a two-dimensional array, which I want to use, erase completely,
> use again, etc.

A simple way of emptying an array:

  @some_array = ();

> Each time, the array indices are different.  Is there an easy way to do this?
> I tried using undef, and while this clears the value in each element, it is
> still remembering the array indices.

I'm not certain why it would keep the array indices.  You can run this snippet to see what's
happening:

  #!/usr/bin/perl -w
  use strict;
  use Data::Dumper;

  my @array = qw(foo bar baz);
  print Dumper \@array;
  undef @array;
  print Dumper \@array;

Can you show us a code snippet where you're having the problem?

Cheers,
Ovid

=====
Ovid                       http://www.perlmonks.org/
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/
Silence Is Evil            http://users.easystreet.com/ovid/philosophy/decency.txt

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com



More information about the Pdx-pm-list mailing list