Skip to content
Create a gist now

Instantly share code, notes, and snippets.

anonymous /gist:4270506

use strict;
use warnings;
use Test::More;
sub r_explicit { return 0; }
sub r_bare { return; }
# Probably not what you expected
my %hash = (
first => r_bare,
second => r_explicit,
ok( exists $hash{'first'}, "'first' exists" );
ok(! exists $hash{'second'}, "'second' unset" );
# Not list context, as it happens
ok(! r_explicit, "r_explicit is false" ); # Passes
# Works like you'd hope
if ( r_explicit ) {
fail("r_explicit is false");
} else {
pass("r_explicit is false");
# Jumping through some real hoops here...
my $wrong_answer =()= r_explicit;
ok( $wrong_answer, "I blame the =()= operator" );
my @wrong_answer = r_explicit;
if ( @wrong_answer ) {
pass("Who evaluates a list for truth, anyway?");
} else {
fail("Who evaluates a list for truth, anyway?");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.