Cymen's Blog

Shooting Yourself in the Foot with Perl

leave a comment

Returning Multiple Values

$error, $hash = function_a( ... );
if ( $error ) { error(); }    // never runs

Correction:

($error, $hash) = function_a( ... );
if ( $error ) { error(); }    // runs on error

Written by Cymen

December 22nd, 2008 at 10:14 am

Posted in Programming

Tagged with

Leave a Reply