Undefine an Array in Perl
To undefine an
array in Perl:
@jiji=("Hi","Hello","Hiya");
undef(@jiji);
-We
create an array named
jiji because typing
jiji is easy. (Arrays start with @)
-We undefine @jiji with Perl's built-in
undef function.
NOTE: You might think: why not just say @jiji=""; But that will not truly clear the array. When you put items back into that array, you will have an extra item at the beginning.
Copy and Paste Perl Code:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
@jiji=("Hi","Hello","Hiya");
undef(@jiji);
print @jiji;
exit;
Resources:
Create or Put Items into an Array in Perl
Splitting an ARRAY in Perl