Link to home
Start Free TrialLog in
Avatar of Talmash
TalmashFlag for Israel

asked on

perl tk : Undefined subroutine &main::Label

I am teaching myself perl-tk.

here is my "first" run:

#!/usr/bin/perl -w
# use strict;
 use Tk;                                          # Slurp the module in.
# -------------------------------------------------------
# Create a main window
# -------------------------------------------------------
my $top = MainWindow->new();
$top->title ("Simple");
# -------------------------------------------------------
# Instantiate widgets and arrange them
# -------------------------------------------------------
$l = $top-->Label('text'   => 'hello',            # label properties
                 'anchor' => 'n',                 # anchor text to "north"
                 'relief' => 'groove',            # border style
                 'width'  =>  10, 'height' => 3);  # 10 chars wide, 3 high.

$l->pack();      # Give it a default place within the main window
# -------------------------------------------------------
# Sit in an infinite loop dispatching incoming events.
# -------------------------------------------------------
MainLoop();


I am using linux station over unix.

talm> perltk simple.prl
Undefined subroutine &main::Label called at simple.prl line 12.

what is the problem with this struct?

thanks,
tal


I understand that $top is struct from type "MainWindow"
Avatar of FishMonger
FishMonger
Flag of United States of America image

Change:
$l = $top-->

To:
$l = $top->

Also, you should be running under strict.
ASKER CERTIFIED SOLUTION
Avatar of FishMonger
FishMonger
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Talmash

ASKER

thanks.