stephen joseph butler wrote:
On 7/13/07, Matt Lawrence <[EMAIL PROTECTED]> wrote:
Perrin Harkins wrote:
> my $vote = $foo if ($bar);  # <--- bad!
>
What's wrong with that? I find it a lot more readable than

my $vote;
if ($bar) {
    $vote = $foo;
}

It doesn't work this way, but suppose you wrote this:

if ($bar) {
 my $vote = $foo
}

Now see why it's wrong? The way you wrote it is kind of ambiguous for
the way we think of postfix operators. If you want something one line,
how about this:

my $vote = $foo ? $bar : undef;

I can't replicate this behaviour. As far as I can tell, the postfix if is identical to the block if I wrote above.


perl -Mstrict -wle 'my $foo = 1 if 0; print defined $foo ? $foo : "undef"'
undef


Has the bug been fixed?

Matt



_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to