Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2015-07-29 02:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls