in reply to Trouble Tracks Tk

The main problem is that you have "use TK;" when you should have "use Tk;" (lowercase k). You should also have "use strict;". The "useless" warnings come from these lines:
	@tmplist;
	$key;
Update: You have a bug, by the way. You really should have my @tmplist; inside the sub xy, so it is initialized each time. Right now you keep adding on to a global array, but you keep using the same four coordinates from the beginning of the array. Since I'm feeling generous today--okay, I'm just avoiding my own work--here is the corrected program, with some stylistic improvements (IMHO):
use warnings; use diagnostics; use Tk; use strict; my @coLour = ('red', 'blue', 'green', 'black', 'orange', 'yellow'); my $width = 600; my $height = 600; my $randi = &randi(); my $mw=MainWindow->new; my $canvas =$mw->Canvas(width => $width, height => $height)->pack(); for (1 .. $randi) { $canvas->create('line', &xy(), -fill => &randcolour()) } MainLoop; sub randcolour{ return $coLour[rand(@coLour)]; } sub xy{ my @tmplist; foreach (1 .. 4) { push @tmplist, rand($width); } return @tmplist; } sub randi{ return rand(50); }

Replies are listed 'Best First'.
Re: Re: Trouble Tracks Tk
by eoin (Monk) on May 27, 2003 at 11:19 UTC
    AAAAHHHHH. Supid stupid stupid.
    Sorry

    All the Best, Eoin...

    If everything seems to be going well, you obviously don't know what the hell is going on.