use File::Glob qw(:glob); sub parseit { my $text = shift; $text =~ tr/[|]/{,}/; $text =~ s/([\\?*])/\\$1/g; map {s/\\([\\?*])/$1/g; $_} bsd_glob($text, GLOB_BRACE | GLOB_NOCHECK); }