Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by CharlesClarkson (Curate)
on Apr 26, 2002 at 05:25 UTC ( [id://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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-25 02:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found