-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Dec 5, 2008, at 10:34 AM, Dermot wrote:
I was looking to test title1 and return that if it was defined else,
test title2 and return that if defined, failing that, return oldtitle.
The ? : operator won't do that. It tests title1 and if true returns
title2. That would not be what I was after!

I think we ended up with the same solution. :-) here what I had.


        my $title;
        if (defined($image->title1)) {
                $title = $image->title1;
        }
        elsif (defined($image->title2)) {
                $title = $image->title2;
        }       
        else {
                $title = $image->oldtitle;
        }       

Wouldn't this work for what you are trying to do:

my $title = $image->title1 || $image->title2 || $image->oldtitle;



Sincerely,
James Moser
[EMAIL PROTECTED]

There are 10 kinds of people in the world.
Those who understand binary, and those who do not.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkk5Z48ACgkQBNt7jTp4/nkhLACgm3sgRSVpyLHHUooj4Nka83B/
7mIAn0xHLJ4GPAuDzHilsfVhwW/Zf2J+
=s6gk
-----END PGP SIGNATURE-----

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to