Perl Clear Array

How Do I Clear An Array in Perl?



To empty an array in Perl, simply define the array to be equal to an empty array:


# Here's an array containing stuff.
my @stuff = ("one", "two", "three");

@stuff = ();
# Now it's an empty array!