# New Ticket Created by Brent Laabs # Please include the string: [perl #127403] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=127403 >
Reported to me by wlewis++ (William Lewis), this took quite a bit of golfing. Works on 6.c all the way up to current Rakudo 86a90b (but only tested moar). Some silent failures, some wrong error messages, occasionally correct. Tons of fun, altogether. Because of the magic number around 256, I suspect the optimizer but didn't test that either. brent@ragnar ~/Downloads> cat golf.pl my $errors = 3; my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); for @stuff -> $line { unless $line ~~ m/1/ { say "seen: $line" if $line.index("2"); } if $line ~~ m/9/ { } } brent@ragnar ~/Downloads> perl6 golf.pl seen: 12 seen: 12 seen: 12 brent@ragnar ~/Downloads> cat golf.pl my $errors = 5; # number of errors is configurable! my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); for @stuff -> $line { unless $line ~~ m/1/ { say "seen: $line" if $line.index("2"); } if $line ~~ m/9/ { } } brent@ragnar ~/Downloads> perl6 golf.pl seen: 12 seen: 12 seen: 12 seen: 12 seen: 12 brent@ragnar ~/Downloads> perl6 golf.pl Invocant requires a type object of type Match, but an object instance was passed. Did you forget a 'multi'? in block <unit> at golf.pl line 4 brent@ragnar ~/Downloads> cat golf.pl my $errors = 3; my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); for @stuff -> $line { unless $line ~~ m/1/ { say "seen: $line" if $line.index("2"); } if $line ~~ /9/ { #lose the m in m// } } brent@ragnar ~/Downloads> perl6 golf.pl Invocant requires a type object of type Match, but an object instance was passed. Did you forget a 'multi'? in block <unit> at golf.pl line 4 brent@ragnar ~/Downloads> perl6 golf.pl seen: 12 seen: 12 seen: 12 brent@ragnar ~/Downloads> cat golf.pl my $errors = 3; my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); for @stuff -> $line { unless $line ~~ /1/ { # works if you lose this m say "seen: $line" if $line.index("2"); } if $line ~~ m/9/ { } } brent@ragnar ~/Downloads> perl6 golf.pl brent@ragnar ~/Downloads> cat golf.pl my $errors = 3; my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); for @stuff -> $line { unless $line ~~ m/1/ { say "seen: $line" if $line.index("2"); } # take out the if block } brent@ragnar ~/Downloads> perl6 golf.pl Invocant requires a type object of type Match, but an object instance was passed. Did you forget a 'multi'? in block <unit> at golf.pl line 4 brent@ragnar ~/Downloads> cat golf.pl my $errors = 3; my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); for @stuff -> $line { unless $line ~~ /1/ { # take out the m again with... say "seen: $line" if $line.index("2"); } # take out the if block } brent@ragnar ~/Downloads> perl6 golf.pl brent@ragnar ~/Downloads>