if (-s "$imagefile" < 700_000_000 and -e "$imagefile") { print ''; print "\n\nISO not too big and exists. \nBurning the CDRW.\n\n" + ."\nPlease be patient, this will take a while...\n\n"; system "sudo cdrecord -v -eject dev=$device $imagefile"; + } ( $? == 0 ) ? &success($date, $time, $hostname, $logdir, $to, $from) : &failure($date, $time, $hostname, $logdir, $to, $from); #### eval { foo() or die "foo failed"; bar() or die "bar bombed"; baz() or die "baz blew chunks"; # etc. }; # don't forget that semicolon! handle_error($@) if $@; # life is good... # ...and in some dark corner of your code sub handle_error { my $msg = shift; if ( $msg =~ /foo/ ) { # deal with foo's error; } elsif ($msg =~ /bar/ ) { # deal with bar's error } # etc. else { # deal with unexpected error } }