in reply to optimise perl code

Madam, you can make use of File::Basename as rev_1318 suggested.

use File::Basename; $dirname = dirname($tempValue); $basename = basename($tempValue); $result = "$dirname\/$temp1\.$temp2\.$basename";

Prasad

Replies are listed 'Best First'.
Re^2: optimise perl code
by graff (Chancellor) on Jul 08, 2005 at 03:42 UTC
    There's no need to escape slashes or periods within a quoted string:
    ... $result = "$dirname/$temp1.$temp2.$basename";
    (you escape a period when you want to match a literal period character in a regex; you escape a slash if you want to match a literal slash in a regex that happens to use the common "/" delimiters, as in /dir\/path/)