Tim Bray : I want to have my idiomatic regexp cake and eat my well-formed XML goodness too.
perl -e 'use strict; use Cwd; my $dir = getcwd; my $i = -1; map { $i += $_ eq "/" } (split("",$dir)); print $i,"\n";'
see also :
'Hello world' should be one statement