NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
More (better?) ways to do it (Score:1)
Is that really what you mean? With it, the value of
$foodepends only on$honk; the values of$barand$bazdon’t come into play at all, even though you test these variables.Also,
I think that could be just
$foo = "foonly" ~~ @vars;.But the solution I’d use is
$foo = 1 if grep $_ ne 'foonly', $bar, $baz, $honk;I don’t consider tha
Re: (Score:1)
Are you sure?
That produces "1" for me, as I expected.
The "if grep" isn't an idiom I'd previously heard. I'll bear it in mind in future.
Re: (Score:1)
Err, d’oh. Somehow I read the code as if you were resetting the variable on each iteration, which is clearly not the case. My bad.