http://qs1969.pair.com?node_id=222647


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