Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 ( #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? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2022-05-21 08:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (76 votes). Check out past polls.

    Notices?