in reply to perl tk how to clear contents of text widget

... Tk::Error: Not a CODE reference ...

You wrote  -command => [$right_frame => \&clear_file] but $right_frame is not \&clear_file, you switched the order for some reason