use strict; use warnings; include('test.pl') > 2 or die('Couldnt include important file!'); # This sub returns the number of bytes read # or a negative number if there was an error... sub include { my $FILE = shift; -e $FILE or return -1; # File doesn't exist -f $FILE or return -2; # not a plain file my $SIZE = -s $FILE; $SIZE > 2 or return $SIZE; # File is basically empty my $CONTENT; my $F; open $F, '<:raw', $FILE or return -3; # Can't open file binmode $F; sysread($F, $CONTENT, $SIZE) == $SIZE or return -4; # Can't read close $F; eval($CONTENT); return $SIZE; } ShowMessage(); ChangeMessage('Whats up!'); ShowMessage(); exit;