in reply to File I/O in Perl/Tk
It's not clear to me from your code, but I think you need to call $father_end->get() to retrieve the contents of the father entry box.
Style-wise, I also recommend not using global variables -- instead passing variables to your subroutines:
sub save_from_entry_widget { my ($widget, $filename) = @_; my $text = $widget->get(); open my $fh, '>>', $filename or die "Cannot append to '$filename': + $!\n"; print $fh $text; }
Then call this with:
save_from_entry_widget( $father_ent, $name_ent->get() );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: File I/O in Perl/Tk
by HeyYou (Novice) on Jan 05, 2006 at 00:58 UTC |