in reply to Trouble with path syntax
Since your s/// works at the end of a string, you could just append to it, with some application of the ? : operator to check if there is a '/' at the end.
$thebase .= (substr($thebase, -1) eq '/') ? 'default' : '/default';
Which is functionally equivilent to:
if(substr($thebase, -1) eq '/') { $thebase = $thebase . 'default'; } else { $thebase = $thebase . '/default'; }
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
|
|---|