[Perl] suppression d'une valeu d'un hash
Fermé
Malco
-
22 juil. 2003 à 08:57
jisisv Messages postés 3645 Date d'inscription dimanche 18 mars 2001 Statut Modérateur Dernière intervention 15 janvier 2017 - 22 juil. 2003 à 09:40
jisisv Messages postés 3645 Date d'inscription dimanche 18 mars 2001 Statut Modérateur Dernière intervention 15 janvier 2017 - 22 juil. 2003 à 09:40
A voir également:
- [Perl] suppression d'une valeu d'un hash
- Forcer la suppression d'un fichier - Guide
- Suppression page word - Guide
- Suppression cookies - Guide
- Suppression compte gmail - Guide
- Suppression pub youtube - Accueil - Streaming
1 réponse
jisisv
Messages postés
3645
Date d'inscription
dimanche 18 mars 2001
Statut
Modérateur
Dernière intervention
15 janvier 2017
934
22 juil. 2003 à 09:40
22 juil. 2003 à 09:40
Hello,
extrait de perldoc perlfunc
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 "tie"d hash or array
may not necessarily return anything.
Deleting an array element effectively returns that
position of the array to its initial, uninitial-
ized 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".
.....
#! /usr/bin/perl -w
%hash = ("key0" => "val0", "key1" => "val1", "key2" => "val2");
delete($hash{"key1"});
devrait faire l'affaire
Johan
The software said "Requires Windows98, Win2000, or better,
So I installed Unix.
extrait de perldoc perlfunc
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 "tie"d hash or array
may not necessarily return anything.
Deleting an array element effectively returns that
position of the array to its initial, uninitial-
ized 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".
.....
#! /usr/bin/perl -w
%hash = ("key0" => "val0", "key1" => "val1", "key2" => "val2");
delete($hash{"key1"});
devrait faire l'affaire
Johan
The software said "Requires Windows98, Win2000, or better,
So I installed Unix.