in reply to How to replace spaces with different chars?
But I don't know how to escape the "," appropriately ...°
use v5.12; use warnings; use Data::Dump qw/pp dd/; my $globber = join ",", (":", ";", "=", "-"); for my $line (<DATA>) { chomp $line; say "--- $line"; $line =~ s/\s/{$globber}/g; say pp [ glob($line) ]; } __DATA__ /a/b/c/d/e/fi le /a/b/c/d/e/fi l e /a/b/c/d/e/f i l e /a/b/c/d/e/f i l e
°) one workaround may be to use a placeholder like "\0" which can't naturally appear and to replace it afterwards.
the whole concept is dubious, because this will create far too many combinations. (Besides solving the original issue) it's better to check incrementally from left to right with wildcards, before progressing to the next position.
my @part = </a/b/c/d/e/f{;,:,=,-}i*>;
etc
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|