Re: "an interview question":

Write a function that takes 'aaaabbbcca' and returns [('a', 4), ('b', 3), ('c', 2), ('a', 1)]

I'm not sure why an interviewer would hate someone enough to ask a question like this, but this seems like a fair response:

% echo aaaabbbcca | perl -nlE '
    s/((.)\2*)/push @things,sprintf "(%s,%s)", $2,length $1 /ge;
    $"=","; say "[@things]"
'
[(a,4),(b,3),(c,2),(a,1)]

I mean, it'd be easier if perl had tuples, but that's what you get for answering a python question in perl when nobody asked you to

Standard perl-golf disclaimer

Please don't do this kind of thing in a production code base