O'Reilly logo

Mastering Perl/Tk by Nancy Walsh, Stephen Lidie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Inserting Items

Use the insert method to add items to the Listbox:

$lb->insert(index, element, element ... );

Each element is another line in the Listbox. The index is a valid index (see Listbox Indexes) before which the new elements will be inserted. For instance, to insert items at the end of the Listbox:

$lb->insert('end', @new_elements);
# Or
$lb->insert('end', "Item1", "Item2", "Item3");

To insert items at the beginning of the Listbox:

$lb->insert(0, @new_elements);

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required