This website requires JavaScript.
Explore
Help
Sign In
mirror
/
RosettaCodeData
mirror of
https://github.com/acmeism/RosettaCodeData.git
Watch
1
Star
0
Fork
You've already forked RosettaCodeData
0
Code
Issues
Packages
Projects
Releases
Wiki
Activity
main
RosettaCodeData
/
Task
/
Run-length-encoding
/
Perl
/
run-length-encoding-1.pl
8 lines
111 B
Perl
Raw
Permalink
Blame
History
sub
encode
{
shift
=~
s/(.)\1*/length($&).$1/g
rse
;
}
sub
decode
{
shift
=~
s/(\d+)(.)/$2 x $1/g
rse
;
}
Reference in New Issue
View Git Blame
Copy Permalink