This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl -w | |
use strict; | |
# Solution to http://beust.com/weblog/2011/10/30/a-new-coding-challenge/ | |
# Chris Dolan | |
# Iterate over all combinations of weights, rejecting cases where they don't sum to 40 | |
for my $w1 (1..37) { | |
for my $w2 ($w1..37) { | |
for my $w3 ($w2..37) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rx="(?^i:(fo+))"; print "fooooobar" =~ $rx; | |
$rx="(?^i:(fo+))"; $qrx = qr/$rx/; print "fooooobar" =~ $qrx'; |