reset $! before system
On Perl 5.8 if $! already has an error then system will not reset it first