Giorgio C has asked for the
wisdom of the Perl Monks concerning the following question:

Hi all,
i have a question hoping you can answer me:
I have a tk script with 2 Buttons and a Scrolled text windows:
1. Button ("OPEN")
2. Button ("Get Statistics")
When i push the "Open" button i choose a .txt file and then the content is printed out in the Scrolled windows. Up to now no problem! The difficulty is this: When i push the "Get Statistic Button" it should call an external Script (that works fine alone) but i wish it worked on the opened file. (opened before with the "Open" button. Can you help me, please ? Here is the tk code and the script i would like
to integrate into.
The Tk script:

You are going to need the pass the file name to the get_statistics subroutine when you call it, which means you probably are going to need to save it in a globally accessible variable. You really should also be checking for definedness / existence of the file and success on open too. Also good practice to use lexical file handles and 3 argument opens. (Not critical but they can help avoid subtle bugs.)