[Melbourne-pm] nearly there...

Jacinta Richardson jarich at perltraining.com.au
Wed Dec 19 21:05:05 PST 2007

Craig Sanders wrote:

> if it bothers you, then strip out the extras yourself:
>          my $full_path = "$dirname/$entry";
>          $full_path =~ s=//=/=g;

Except, don't use = as your separator.  It breaks people's brains.  Use 
curly braces instead:

	$full_path =~ s{//}{/}g;

or anything which doesn't already have a strong semantic map already 
(which is hard, because this is Perl, and Perl uses almost all the 
punctuation for something), and which can reasonably be assumed to be 
obvious to a 6 months Perl user.

Curlies are great for pick-your-delimiter stuff:

	q{single quoted}
	qq{double quotes}
	qx{quoted executable}
	qr{precompiled regular expression}

If absolutely necessary (for example the string/expression contains 
unmatched }s, I'll use ()s, []s, !s or at worst #s.

All the best,


More information about the Melbourne-pm mailing list