, + " " \s{2}, " ". , .
use strict;
use warnings;
for (0 .. 10) {
$_ = " " x $_;
printf "%-13s %s\n", "[$_]:", /^(\s{2})+$/ ? "match!" : "no match.";
}
:
[]: no match.
[ ]: no match.
[ ]: match!
[ ]: no match.
[ ]: match!
[ ]: no match.
[ ]: match!
[ ]: no match.
[ ]: match!
[ ]: no match.
[ ]: match!
, TAB .
. - /m /g , , , , . TAB.
use strict;
use warnings;
$_ = <<EOText;
Three
Two
Four
Five
Zero
One
EOText
s/^ /\t/mg;
s/\t/\\t/g;
print;
:
\t Three
\tTwo
\t Four
\t Five
Zero
One
, s/// . TAB.
, . ,
$ perl -pe 's/^ /\t/' input-file >output-file
$ perl -i.bak -pe 's/^ /\t/' input-file