Retrieving Text

The get function is one you’ll use a lot. It returns the text located from index1 to index2 . If index2 isn’t specified, only the character located at index1 is returned. The usage of get is as follows:

$t = $text->get(index1 [ , index2 ]);

As with any index ranges, index1 must be less than or equal toindex2, or an empty string will be returned.

Get Mastering 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.