IceWalkers.com - Linux Software downloads and news
Name : Password :
Linux SoftwareLinux RPMLinux HowtosLink UsAboutAdvertise

Delete

 Perl Doc. Index   Quick jump:  
 
delete
delete EXPR

Given an expression that specifies a hash element, array element, hash slice, or array slice, deletes the specified element(s) from the hash or array. In the case of an array, if the array elements happen to be at the end, the size of the array will shrink to the highest element that tests true for exists() (or 0 if no such element exists).

Returns each element so deleted or the undefined value if there was no such element. Deleting from $ENV{} modifies the environment. Deleting from a hash tied to a DBM file deletes the entry from the DBM file. Deleting from a tied hash or array may not necessarily return anything.

Deleting an array element effectively returns that position of the array to its initial, uninitialized state. Subsequently testing for the same element with exists() will return false. Note that deleting array elements in the middle of an array will not shift the index of the ones after them down--use splice() for that. See /exists.

The following (inefficiently) deletes all the values of %HASH and @ARRAY:

    foreach $key (keys %HASH) {
	delete $HASH{$key};
    }
    foreach $index (0 .. $#ARRAY) {
	delete $ARRAY[$index];
    }

And so do these:

    delete @HASH{keys %HASH};
    delete @ARRAY[0 .. $#ARRAY];

But both of these are slower than just assigning the empty list or undefining %HASH or @ARRAY:

    %HASH = ();		# completely empty %HASH
    undef %HASH;	# forget %HASH ever existed
    @ARRAY = ();	# completely empty @ARRAY
    undef @ARRAY;	# forget @ARRAY ever existed

Note that the EXPR can be arbitrarily complicated as long as the final operation is a hash element, array element, hash slice, or array slice lookup:

    delete $ref->[$x][$y]{$key};
    delete @{$ref->[$x][$y]}{$key1, $key2, @morekeys};
    delete $ref->[$x][$y][$index];
    delete @{$ref->[$x][$y]}[$index1, $index2, @moreindices];
 Perl Doc. Index   Quick jump:  
 
PhpMyAdmin 3.2.4 rc1
Php front-end to MySQL administration
Exim 4.71
Message transfer agent
Opera 10.10
Opera for Linux
ImageMagick 6.5.7.10
ImageMagick image processing studio
DeleGate 9.9.6-pre6
Proxy server which runs on multiple platforms
Inkscape 0.47
Vector graphic editor for SVG
Nano 2.1.99pre2
Emulate Pico while also offering a few enhancements.
Google Chrome Browser 4.0.249.11
Google’s open source browser project
Rhythmbox 0.12.6
Integrated music management application
Tellico 2.1.1
Collection manager for books, music, videos, and bibliographies
Free IT Magazines, White Papers, eBooks, and more !
Oracle Magazine

Contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more.

Vulnerability Management for Dummies

Get all the Facts and See How to Implement a Successful Vulnerability Management Program.

Website Magazine

Has tapped premier talent in the Internet industry for our content and each and every issue will contain practical advice and insights for website owners.

Linux Software Map
Find Linux RPM
Best Rated Linux Software
Most Rated Linux Software
Linux Distributions
Linux Howtos
Quick Survey

Please take our survey and help us improve our website to serve you better.

Thank you.
Linux Software
Linux / IT Resources
Site Resources
Google
Privacy Policy
Contact Us
Submit Software
Advertising info