$ perl -le ' "abcd" =~ /.{2,}(?{print $&})(*FAIL)/ ' abcd abc ab bcd bc cd $ perl -le ' "abcdefg" =~ /.{2,}(?{print $&})(*FAIL)/ ' abcdefg abcdef abcde abcd abc ab bcdefg bcdef bcde bcd bc cdefg cdef cde cd defg def de efg ef fg $ #### $board =~ /(?[1] <=> length $a->[1] } @pat; say "patterns----------------"; dd @pat; #### default is 71 d. old is d. highs is 10 under is d underpat is (?^u:[^db e h i n n o]) words are de do changed is 21 --------------------three choses: 1 38 vibe score: 20 20 .......... 0000000000 .......... 0000000000 .......... 0000000000 .......... 0000000000 ....m..... 0000100000 ..avoid... 0011111000 ...it..... 0001100000 ...bi..... 0001100000 ...ef..... 0001100000 ....s..... 0000100000 /home/bob/4.scripts/distro/games/29-11-2019-16-37-01.txtmove is 2 end of move, continue? #### $ ./1.perlvar.pl 10 15 This is a Hello World program World $ #### #!/usr/bin/perl use 5.016; use warnings; my $str="This is a Hello World program"; $str=~/Hello/; say $-[0]; # $-[0] is the offset of the start of the last successful match. say $+[0]; # $+[0] is the offset into the string of the end of the entire match. $str=~/(This)(.*?)Hello(.*?)program/; say $str; say $+; # This returns the last bracket result #### my $newmask = ( $old ^ $word ) =~ tr/\0/\xff/cr; $flip and ( $board, $heights ) = flip $board, $heights; substr $board, $pos, length $word, $word; #say "new mask is $newmask"; substr $heights, $pos, length $highs, ( $highs & $newmask ) =~ tr/0-4/1-5/r | ( $highs & ~$newmask ); $flip and ( $board, $heights ) = flip $board, $heights; my $tiles = join '', @tiles; say "word is $word"; $tiles =~ s/$_// for split //, $word & $newmask; #### sub matchrule { my ( $old, $highs, $word ) = @_; $old eq $word and return 0; my $newmask = ( $old ^ $word ) =~ tr/\0/\xff/cr; ( $newmask & $highs ) =~ tr/5// and return 0; my $tiles = "@tiles"; $tiles =~ s/$_// or return 0 for ( $newmask & $word ) =~ /\w/g; return 1; } #### #my $return2=$save_file->append_utf8(@players); #say "return2 is $return2"; #my $return2=$save_file->append_utf8(@{players}); #say "return2 is $return2"; #my $return2=$save_file->append_utf8($players); #say "return2 is $return2"; #my $return2=$save_file->append_utf8(`dd @players`); #say "return2 is $return2"; #my $return2=$save_file->append_utf8({@players}); #say "return2 is $return2"; #### @ARGV or @ARGV = qw( one two three four ); # for testing # ... my @players; my $maxname = ''; for (@ARGV) { $maxname |= $_; push @players, { name => $_, score => 0, tiles => [ sort splice @drawpile, 0, $maxtiles ] }; } #### # initiate time my $start = [gettimeofday]; #print qq|$time{'yyyymmdd hh:mm:ss.mmm', $start}\n|; #$save_file->append_utf8("$time{'yyyymmdd hh:mm:ss.mmm', $start}\n"); #### ... Duration of move 4 is 27.942196 Current player is 0 Board is .......... .......... .......... .......... .......... .gridders. .......... .......... .......... .......... Heights is 0000000000 0000000000 0000000000 0000000000 0000000000 0324441110 0000000000 0000000000 0000000000 0000000000 patterns---------------- Board is .......... .....g.... .....r.... .....i.... .....d.... .....d.... .....e.... .....r.... .....s.... .......... Heights is 0000000000 0000030000 0000020000 0000040000 0000040000 0000040000 0000010000 0000010000 0000010000 0000000000 patterns---------------- Duration of move 5 is 31.07824 Current player is 1