# 3 spaces, a tab, 3 more spaces, another tab and 3 more spaces (represent by chr() for clarity) $test = chr(32)x3 . chr(9) . chr(32)x3 . chr(9) . chr(32)x3; ($first = $1, $second = $2) if $test =~ /(\s*)\t(\s*)/;