version: pmchat cat pmchat | grep '\$$Id' | head -1 | cut -f4 -d' ' > version #### sub autoupdate { my $r=$ua->request(GET "http://www.mrnick.binary9.net/pmchat/version"); my($ver)=$r->content=~/^([\d\.]+)$/; my($this)=$ID=~/,v\s+([\d\.]+)/; print "This version is $this, the current version is $ver.\n"; if ($this >= $ver) { print "There is no need to update.\n"; return; } $r=$ua->request(GET "http://www.mrnick.binary9.net/pmchat/pmchat"); unless (open (OUT,">/tmp/pmchat.$ver")) { print "Unable to save newest version to /tmp/pmchat.$ver\n"; return; } print OUT $r->content; close OUT; print "/tmp/pmchat.$ver now contains the newest version.\n"; }