Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] TK - Arrays

Expand Messages
  • Charles K. Clarkson
    Chirhart, Brian ... [snip] In any collection of data, the figure most obviously correct, beyond all need of checking, is the mistake.
    Message 1 of 1 , Apr 19, 2002
    • 0 Attachment
      "Chirhart, Brian" <bchirhart@...>

      : I have a program that I am writing that will open several windows.
      : There is no real limit as to the number of windows someone may
      : open. I want to give each window it's own variable, yet not have
      : to write separate code for each window. I was wondering if
      : there is a way to assign an array to a Tk widget instead of a scalar
      : variable.
      :
      : My code that I thought would work is:
      :

      [snip]

      "In any collection of data, the figure most obviously correct,
      beyond all need of checking, is the mistake."
      - Finagle's Third Law

      my $x = 0;
      for $x ($x = 0 .. 5) {
      print "Hello";
      }

      Q Guess how many time this will print Hello?

      A The same as this:

      my $x = 0;
      for $x ($x = 0 .. 1_000_000_000) {
      print "Hello";
      }

      Always test _everything_.

      for my $x ( 0 .. 5 ) {

      }

      Will do what you want. Reread perlsyn for the correct
      form for 'for' and 'foreach'.

      BTW:

      my $x = 1_000_000_000;
      for $x (0 .. 5) { }
      print $x;

      What value do you think prints here?


      HTH,

      Charles K. Clarkson
      --
      Head Bottle Washer,
      Clarkson Energy Homes, Inc.
      254 968-8328

      CJ Web Work - Domains for Real Estate Investors.

      Please don't take offense at my comments. I'm feeling a bit sarcastic today.
    Your message has been successfully submitted and would be delivered to recipients shortly.