my $newrate = 0; ### AVOID ANY NASTY DIVISION-BY-ZERO ERRORS WITH AN EVAL... eval { my $newrate = ($first_currency / $second_currency); }; ### IF EVAL FAILS, LET'S PRINT THE ERROR... print $@; #### my $newrate = 0; if( $second_currency == 0 ) { warn "Second currency was zero\n"; } else { $newrate = $first_currency / $second_currency; }