title: Continue instead of 'or die' in Perl
body: <p>I have a loop in my Perl script that prepares and executes a SQL statement, like this:</p>
  
  <pre><code>my $sql_1 = select * from TABLE; 
  my $sth_1 = $database-&gt;prepare($sql_1) or die "Failed to prepare SQL"; 
  $sth_1-&gt;execute() or die "Failed to execute SQL"; 
  my $results = sth_1-&gt; fetchall_arrayref({}); 
  
  my params_ins; 
  my params_del; 
  
  foreach my $row($results) { 
    params_ins = $row-&gt;{params_ins} 
    params_del = $row-&gt;{params_del} 
  
    my $sql_2 = 
      begin transaction 
        exec delete_sp(params_ins) 
        exec insert_sp(params_del) 
      end transaction 
  
    my $sth_2 = $database-&gt;prepare($sql_2) or die "Failed to prepare SQL"; 
    $sth_2-&gt;execute(); 
  } 
  </code></pre>
  
  <p>As I understand, die will cause the execution of the code to stop. Would it be possible to continue to the next loop instead of stopping the whole execution of the script? For example, would it be possible to do something like:</p>
  
  <pre><code>  my $sth_2 = $database-&gt;prepare($sql_2) or continue; 
    $sth_2-&gt;execute(); 
  </code></pre>
  
  <p>Would 'or next' work?</p>