No, theres a lot more to it than that. The example was a very stripped down version.
Perhaps a better one is to consider an interactive SQL program. Your script wants to run some sql, get back the number of rows processed and then decide whether the transaction should be commited or rollbacked. (Note this is only an example - anyone who mentions DBI will be shot ;-)