#!/usr/local/tcl8.5a6/bin/tclsh

#
proc setglobal {} {
#
  global global;
#
  for { set x 0; } { ${x} < 50 } { incr x; } {
    set y [format "%02u" ${x}];
    set global(v${y}) "v${y}";
  };
  return 0;
};

#
proc mytest {x} {
#
  global global;
#
  switch -regexp -- ${x} \
    ^${global(v00)} - ^${global(v01)} - ^${global(v02)} - \
    ^${global(v03)} - ^${global(v04)} - ^${global(v05)} - \
    ^${global(v06)} - ^${global(v07)} - ^${global(v08)} - \
    ^${global(v09)} - ^${global(v10)} - ^${global(v11)} - \
    ^${global(v12)} - ^${global(v13)} - ^${global(v14)} - \
    ^${global(v15)} - ^${global(v16)} - ^${global(v17)} - \
    ^${global(v18)} - ^${global(v19)} - ^${global(v20)} - \
    ^${global(v21)} - ^${global(v22)} - ^${global(v23)} - \
    ^${global(v24)} - ^${global(v25)} - ^${global(v26)} - \
    ^${global(v27)} - ^${global(v28)} - ^${global(v29)} - \
    ^${global(v30)} - \
    "PUT ^ IN FRONT OF THE PRECEDING LINE AND EXECUTION TIME GETS ABOUT 9 TIMES MORE" {
  } \
  ;
  return 0;
};

#
proc main {argc argv} {
#
  global global;
#
  setglobal;
  for { set i 0; } { ${i} < 10000 } { incr i; } {
    mytest "";
  };
  return 0;
};

exit [main ${argc} ${argv}];
