$text="Tommy tom ticked a tick at the ticket counter"; $t_count=($text=~ y/[tT]/t/); print "This text has $t_count Ts\n"; #result #This text has 9 Ts #### $_ = "1.0 and 2.4 and 310 and 4.7 and so on"; @a = m/([\d|\.]+)\D+/g; print "@a\n"; #result #1.0 2.4 310 4.7