Matthias Urlichs wrote:
> f=create_a_file(name)
> try:
> do_something_insanely_complicated(f)
> except:
> os.unlink(f)
> raise
>
> What this does is fairly obvious. What's more, this is a fairly standard
> Python idiom which quickly becomes second nature (IMHO).
>
> Now try the same thing in Perl.
$f=create_a_file($name);
eval {
do_something_insanely_complicated($f);
};
if ($@) {
unlink $name;
die $@;
}
Of course this is rare, since perl code that is ill-behaved enough to
throw an exception is rare, so it's more standard perl idiom to write:
do_something_insanely_complicated(create_a_file($name)) or unlink($name);
--
see shy jo
Attachment:
signature.asc
Description: Digital signature