in reply to -z file test operator
You can use the filetest operators on either a filename or a FILEHANDLE. Here is a demo, save it as whatever. It opens itself, tests for file size against its name and FH (both the same) and then unlinks itself:
open SELF, $0 or die "Can't open myself $!\n"; print "My name is $0\n"; print "I am ", -s SELF, " bytes\n"; print "That's ", -s $0, " bytes\n"; close SELF; unlink $0 and die "Deleted myself, I'm outta here!\n";
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|