Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

command does NOT remove a file

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Joined
Feb 6, 2002
Messages
1,851
Location
IL
HI,

Why the following command does NOT remove $FILE1 ?

my $but3 = $mw -> Button(-text=>"QUIT", -command =>sub{\&KILL_MON}, -command =>sub{unlink $FILE1} ,-command =>sub{$mw->destroy})-> pack(-side => 'left');#Quit button

Thanks


Long live king Moshiach !
 
Did you answer your question with the other post? Buttons can only have one -command at a time.

It's important to know how Perl data structures work. Oftentimes modules want you to pass in associative arrays in their methods. Associative arrays (hashes) tie a key with a value, so each key has to be unique.

Code:
my %sounds = (
   dog => 'bark',
   cat => 'meow',
   pig => 'oink',
   cat => 'purr', # override the first "cat" definition
);

print $sounds{cat};
 
Thanks,
Yes,your orher reply have cleared this one as well.
I know about the structures,however how does it relate to my question ?

P.S. starting slow with the Perl/Tk,since could not find a proper quickstart/tutorial on web.

Long live king Moshiach !
 
It relates to your question because Tk widgets take associative arrays, and in your original post you defined three values with the same key, which is one reason it wasn't working properly.
 
OK.
Coupld you please point me to some really good resource on web on the Perl/Tk issues - reference/tutorial/etc. ?

Thanks



Long live king Moshiach !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top