in reply to Tcl::Tk getOpenFile Not Working - Missing File Operand

Thank you for pointing that out. Indeed it was a mistake.

However, I have now changed the variable call to ${select_input_file} (and updated my original post), but the error of "missing operand" still persists.

  • Comment on Re: Tcl::Tk getOpenFile Not Working - Missing File Operand

Replies are listed 'Best First'.
Re^2: Tcl::Tk getOpenFile Not Working - Missing File Operand
by almut (Canon) on Feb 21, 2008 at 00:38 UTC

    As you have it, the scope of the lexical variable my $select_input_file is limited to the sub open_file. A quick hack would be to declare it outside of the sub, so it becomes globally visible.

    BTW, using strictures would have warned you that $select_input_file within push_button() is not what you thought it is...

Re^2: Tcl::Tk getOpenFile Not Working - Missing File Operand
by NetWallah (Canon) on Feb 21, 2008 at 00:42 UTC
    Your "sub open_file" declares a LOCAL lexical my $select_input_file.

    Your "push_button" gets a different (uninitialized) variable with the same name.

    Lesson : always use strict;

         "As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom