7.8. Deleting Items

You can use the delete method to delete items from the listbox:

$lb->delete(firstindex
				[, lastindex ]);

The first argument is the index from which to start deleting. To delete more than just that one item, you can add a second index. The firstindex must be less than or equal to the lastindex specified. To delete all the elements in the listbox:

$lb->delete(0, 'end');

To delete the last item in the listbox:

$lb->delete('end');

Get Learning Perl/Tk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.