in reply to print backslash in variable

... I must know, how many backslashes in a row ...

A way:

c:\@Work\Perl\monks>perl -wMstrict -le "my $s = '\\\\\---\--\\\\---\\--\\\-'; print qq{'$s'}; ;; printf ' %d', $_ for map tr{\\}{}, $s =~ m{ \\+ }xmsg; " '\\\---\--\\---\--\\-' 3 1 2 1 2

Update: map expression was  scalar(tr{\\}{\\}) but I realized scalar wasn't necessary.


Give a man a fish:  <%-{-{-{-<