Porting perl back to ruby