in reply to s/// and variable interpolation

Rather than battling with regular expressions, I would choose to use a module to deal with this problem:

use File::Basename qw/basename/; my $file = shift || '//server/c$/app/bin/somefile.txt'; print( basename($file), "\n" );

The beauty of this approach is twofold. Firstly, the module File::Basename is supplied as part of the core Perl distribution, so it is always present (unless you happen to stumble across a particularly stripped-down Perl installation).

Secondly, it is written to be platform-independent. Take that code anywhere, and it will perform as expected. One less damned thing to go wrong.


print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'