You don't need the do {} block at all. You could print the same message without the do{}.
my $dbh = DBI->connect( "DBI:mysql::$mysql_host", $mysql_user, $mysql_pass ) or die "statement before dying\nCan't connect, $DBI::errstr\n"; Above should do for you. Mimi On 20/06/2008, John W. Krahn <[EMAIL PROTECTED]> wrote: > > boole wrote: > >> Hello sorry for this lame question but I can't search it becuase I >> don't know how to explain it in searchable terms, what I did search >> turned up nothing useful. >> >> How can you execute multiple statements in Perl when perl expects one >> statement? >> >> Like I thought this would work: >> >> $dbh = DBI->connect("DBI:mysql::$mysql_host", $mysql_user, >> $mysql_pass) >> or { >> print "print statement before dying\n"; >> die "Can't connect, $DBI::errstr\n"; >> } >> >> But it doesn't work, I get syntax error, so how could I say: >> >> or: >> execute statement one; >> and execute statement two; >> end of condition. >> > > > my $dbh = DBI->connect( "DBI:mysql::$mysql_host", $mysql_user, $mysql_pass > ) > or do { > print "print statement before dying\n"; > die "Can't connect, $DBI::errstr\n"; > }; > > > John > -- > Perl isn't a toolbox, but a small machine shop where you > can special-order certain sorts of tools at low cost and > in short order. -- Larry Wall > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > >