Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: What is true and false in Perl?

by Anonymous Monk
on Oct 17, 2012 at 23:40 UTC ( #999632=note: print w/replies, xml ) Need Help??


in reply to Re^3: What is true and false in Perl?
in thread What is true and false in Perl?

what are you trying to say?

Replies are listed 'Best First'.
Re^5: What is true and false in Perl?
by jdporter (Canon) on Oct 18, 2012 at 15:25 UTC

    The same thing tobyink and tye said, though more obtusely and snarkily.

    Here's another example:

    tie my $var, 'Some::BlackBox::Module'; $var = "45"; if ( $var ) { print "var is true\n" } # doesn't print! WTF?

    The mere fact that an expression evaluates to a true value in scalar context doesn't mean it is true.

    tie and overload are among the user-accessible features which can muddy the true/false waters.

    An example like this should make the principle more obvious:

    my $obj = ObjectWithLotsOfOpaqueStructure::AndLotsOfHiddenState->new( -use_overloading => 1, ); if ( $obj ) { print "obj is 'true'.\n"; # What does this even mean? # Maybe obj is an iterator with another available item? }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999632]
help
Chatterbox?
[Lady_Aleena]: I'll just have to search for the files using the subs and open them up.
[Discipulus]: nice Perl dreams, folks.. shower->Dumas->bed
[erix]: pere ou fils?
[Lady_Aleena]: Discipulus, good night.
[Discipulus]: pere, le vicomte de bragelonne.. wonderfull
[erix]: I'll keep that in mind (haven't read), buona notte :)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2017-05-23 19:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?