in reply to Appending values to variable.

Hi nisha, You can do easily using regex.

$filepath =~ s|/|\\|g;

updated: Also you can make use of tr/// as davorg suggested

Prasad

Replies are listed 'Best First'.
Re^2: Appending values to variable.
by davorg (Chancellor) on Nov 16, 2005 at 11:48 UTC

    Two small points:

    1. Your code doesn't compile. You need to escape the \ in the replacement string (s|/|\\|)
    2. There is no need to use the regex engine if you're replacing one character with another. That's what tr/// is for.
    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg