Sophia, et al
> If you know in advance the array index then use splice.
If you know only the value you want to remove (and you like map...):
#/usr/bin/perl -w
use strict;
my %compilers = (
system1 => ['compiler_a'],
system2 => ['compiler_b', 'compiler_c','compiler_d'],
system3 => ['compiler_e'],
> "John" == John W Krahn <[EMAIL PROTECTED]> writes:
John> From the foreach loop it looks like you want to remove the last
John> occurrence of $del_name from @pro_list. You could also do it like this:
John> foreach ( reverse 0 .. $#pro_list ) {
John> if ( $pro_list[$_] eq $del_name ) {
J
Ebaad Ahmed wrote:
>
> Just used the following code to delete a specific value from an array, populated
> from text read from file. Please let me know if i can be of any help.
> sub doDeleteProvider {
> my $cgi = shift;
> my $counter = 0;
> my $index;
> my $del_name = $cgi->param("names");
>
Just used the following code to delete a specific value from an array, populated from
text read from file. Please let me know if i can be of any help.
sub doDeleteProvider {
my $cgi = shift;
my $counter = 0;
my $index;
my $del_name = $cgi->param("names");
my $TITLE = "Nighthawk Database";
fo
Hey Sophia,
My MUA believes you used
to write the following on Thursday, January 9, 2003 at 6:48:42 PM.
SC> I am not sure how to delete a specific value from a hash whose
SC> keys contains multiple values.
SC> Could anyone advice, please?
Does this help?
perldoc -q delete
--
Tim Mu
Sophia Corwell wrote:
>
> Sorry about that...
>
> Here is an example:
>
> Here is what my hash looks like:
>
> %compilers = (
>system1 => ['compiler_a'],
>system2 => ['compiler_b',
> 'compiler_c','compiler_d'],
>system3 => ['compiler_e'],
> );
>
> Now, if I want to delete just the
Thanks for the example :-). You want either 'delete' or 'splice'
Depending on whether you want the indexes to be shifted down, see
perldoc -f delete and perldoc -f splice.
"Deleting an array element effectively returns that position of the
array to its initial, uninitialized state. Subsequent
Sophia Corwell wrote:
> Sorry about that...
>
> Here is an example:
>
> Here is what my hash looks like:
>
> %compilers = (
>system1 => ['compiler_a'],
>system2 => ['compiler_b',
> 'compiler_c','compiler_d'],
>system3 => ['compiler_e'],
> );
>
> Now, if I want to delete just the 'c
I am not sure I understand you correctly. Are you referring to a hash
which may have a list of values stored with a particular key? Keys by
the nature of a hash must be unique, so the hash is changed/deleted from
in the same way regardless.
I also didn't understand if you meant clearing the v
Sorry about that...
Here is an example:
Here is what my hash looks like:
%compilers = (
system1 => ['compiler_a'],
system2 => ['compiler_b',
'compiler_c','compiler_d'],
system3 => ['compiler_e'],
);
Now, if I want to delete just the 'compiler_c' value
from the system2 key, can I use th
10 matches
Mail list logo