How does the following work, specifically the triple equal sign print "hello" =~ y===c # -> 4
submitted by /u/Both_Confidence_4147
[link] [comments]
I want to process lines that start on "ROW<number> blabla" and increment the number by 2. Eg: "ROW13 There's a lazy brown fox" -> "ROW15 There's a lazy brown fox".
My first attempt:
perl -pe 's/(\d+)/$1+2/e'
works but replaces numbers EVERYWHERE not just after ROW, so I tried:
perl -pe 's/ROW(\d+)/ROW$1+2/e'
but this doesn't work at all.
submitted by /u/redzorino
[link] [comments]
The latest dev release of Type::Tiny made some changes to its behavior with tie.
Being the kind of person who enjoys playing with shiny new things, I went to see how I could wrangle it into core classes:
```perl use v5.40; use experimental qw<class>;
class Foo { use Types::Standard qw<Int>; field $bar :param; ADJUST {tie $bar, Int, $bar} }
Foo->new(bar => "baz");
Value "baz" did not pass type constraint "Int"
```
Neat!
submitted by /u/m_dango
[link] [comments]