Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: Golf Challenge - does $x and $y fit into the same slot on @z?

by ehdonhon (Curate)
on Dec 27, 2002 at 23:41 UTC ( [id://222647]=note: print w/replies, xml ) Need Help??


in reply to Re: Golf Challenge - does $x and $y fit into the same slot on @z?
in thread Golf Challenge - does $x and $y fit into the same slot on @z?

Wow. You came up with the exact same thing as I did, except for two little syntax differences. This is what I had. If I had knon that I didn't need the curly's on the grep, and if you reversed the order in your evaluations, they would be the same.

use strict; my $x = 4; my $y = 38; my @z = ( 1, 3, 38, 83 ); print "Yes\n" if ((grep{$_<$x}@z)==(grep{$_<$y}@z));
  • Comment on Re: Re: Golf Challenge - does $x and $y fit into the same slot on @z?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 21:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found