Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Can If-then conditions do ($a = $b = $c) type expressions?

by CharlesClarkson (Curate)
on Apr 26, 2002 at 05:25 UTC ( #162180=note: print w/ replies, xml ) Need Help??


in reply to Can If-then conditions do ($a = $b = $c) type expressions?

Enter Quantum::Superpositions

use Quantum::Superpositions; my $a = my $b = my $c = 5; if ( all( $a, $b, $c) == 5) { print "They are all 5\n"; } else { print "They are not the same\n"; }

Or more generally

use Quantum::Superpositions; my $a = my $b = my $c = 5; if ( all($a, $b, $c) == all( $a, $b, $c) ) { print "They are the same\n"; } else { print "They are not the same\n"; }

Update: The second idiom is better written as:

if ( all($a, $b, $c) ) { print "They are the same\n"; } else { print "They are not the same\n"; }



HTH,
Charles K. Clarkson
Clarkson Energy Homes, Inc.


Comment on Re: Can If-then conditions do ($a = $b = $c) type expressions?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://162180]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2014-10-23 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (123 votes), past polls