Skip to content

Instantly share code, notes, and snippets.

@sshaw sshaw/rle.txt
Last active Apr 5, 2019

What would you like to do?
Run-length encoding in Perl. Does not support integers :)
perl -E'print $+[1]-$l,$& and $l=$+[1] while $ARGV[0] =~ /(.)(?!\1)/g' aaabbbcdeee
perl -E'print $2 x $1 while $ARGV[0] =~ /(\d+)(.)/g' 3a3b1c1d3e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.