[Israel.pm] Golf

Madani, Srikanth, VF-DE Srikanth.Madani at vodafone.com
Fri Nov 4 02:44:04 PST 2005

Roie Marianer wrote on Freitag, 4. November 2005 11:14

>> $Done = what(0) || "etwas";
> All the solutions that were presented here, except for the Perl 6 ones

> (Mikhael Goikhman and Gaal Yahas) have a subtle flaw that can result
if your 
> "what" function returns false values:

You're right - good call! And it's not subtle.

However, my function returns either a scalar (string value) or undef. A
bit like open() which returns non-zero on success and undef otherwise; I
want to use it like open() is used in conjunction with die.

	open (FILE, ">$file_name") || die "\nIt's all over! Over, I tell

Real world example:
	my $duser = Find_deletion_requestor($segment, $topic, $dfile) ||

Apart from the innate satisfaction of Golf, I think it's rather readable
too. [as long as it doesn't return 0]

Srikanth Madani

How beautiful it is to do nothing, and then rest afterward.  
  -Spanish proverb (attributed anyway)

More information about the Perl mailing list