worked for me :)
looks like you're using [] instead of {} ... PHP instead of PERL maybe ??
%myList = ("1","a","2","b");
print "Before: \n";
while (($key,$val) = each(%myList)) {
print "$key --> $val\n";
}
delete($myList{"1"});
print "\n\n\n After: \n";
while (($key,$val) = each(%myList)) {
print "$key --> $val\n";
}
--- Ouput ---
steve@whosyourdaddy:/tmp$ ./test
Before:
1 --> a
2 --> b
After:
2 --> b
steve@whosyourdaddy:/tmp$
Hope this helps,
Steve
On Fri, 21 Dec 2001, Sharat Hegde wrote:
> Hello,
>
> I need to delete an element from a list (array). The delete function does
> not seem to work. For example if I need to delete element number "i" from
> the list "myList", then the code
>
> delete ($myList[$i]);
>
> does not seem to be working. Gives a compilation error.
>
> What is the alternative?
>
> Regards,
> Sharat
>
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
Thank you,
Steve Maroney
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]