(used uppercase X for demo only, switching to lowercase works too)
OUTPUT:use v5.12; use warnings; # https://perlmonks.org/?node_id=11141581 my $in = "anXwxdXdzd"; my $pi = "1415926535"; my $mask = $in =~ tr/Xa-z/\xff\x00/r; my $re = $pi & $mask; $re=~ tr/\x00/./; $re = "/bin/grep $re /path/to/some/file"; say $re;
/bin/grep ..1...6... /path/to/some/file
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^2: string substitution
by LanX
in thread string substitution
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |