use strict; use warnings; use 5.012; my @list = ("C:\\username\\Sources"); for (@list) { say "array char = $_"; while ($_ =~ m/\\/g) { say "found a '$&'"; # holds the portion of the string that matched } }