Won't someone please care for them? The pentuplets appeared on my doorstep. They all do the same thing. Can you figure it out? I could tell you, but where's the fun in that?
# 57*3 = 171
sub emb1 {
$_[0]=~/^(?{[("")x2]})(.*)(?{[$^R->[0].$1,$^R->[1]]})(?:(
.)(?{[$^R->[0],$^R->[1].$2]})(.*)(?{[$^R->[0].$3,$^R->[1]
]}))*\z(?(?{$^R->[0]eq$_[1]})(?{$_[2]=$^R->[1]})|(?!))/sx
}
# 54*3 = 162
sub emb2 {
our$i=\$_[2];@_=@_;my$R;$R=qr/(?{substr$_[1],0,1,''})(
(??{''ne$^R&&"[^\Q$^R\E]*\Q$^R"}))(?{chop($$i.=$1)if$1
ne'';$^R})(??{''ne$^R&&$R})(?{$$i.=$'})/x;$_[0]=~/^$R/
}
# 52*3 = 156
sub emb3 {
@_=(@_,our$i=\$_[2]);$_[0]=~m{^(?(?{${$^R=\substr$_[
1],0,1}ne''})((??{"[^\Q${$^R}\E]*\Q${$^R}"}))(?{chop
(${$^R},$$i.=$1)}))+(?(?{$_[1]ne''})^)}&&($$i.=$',1)
}
# 49*3 = 147
sub emb4 {
use re"eval";$_[0]=~m{^@{[map+qr{(?>([^$_]*)$_(?{
$_[$^F].=substr($_[$%],$-[-1],$+[$#-]-$-[-1])}))}
,map+quotemeta(),split//,$_[1]]}}x&&($_[2].=$',1)
}
# 41*3 = 123
sub emb5 {
$_[0]=~m{^@{[map"([^\Q$_\E]*)\Q$_",split/
/x,$_[1]]}}x&&($_[2]=join('',map(substr($
_[0],$-[$_],$+[$_]-$-[$_]),1..$#-),$'),1)
}
_____________________________________________________
Jeff
[japhy]Pinyan:
Perl,
regex,
and
perl
hacker, who'd like a
job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.