Substitution Problem

From: Ashok (ashoktamil_at_yahoo.com)
Date: 07/18/04

  • Next message: Gunnar Hjalmarsson: "Re: Substitution Problem"
    Date: 18 Jul 2004 13:48:48 -0700
    
    

    I am having some problem with the substitution operation. This is what
    I am trying to do:

    Get a directory path from the user and also the search string in the
    path and remove the string from the path.

    Input String: c:\ashok\temp\perl
    Search String: c:\ashok

    So the output should be temp\perl.

    The Program I wrote looks like this:

    $input = <STDIN>;
    $search = <STDIN>;

    $input =~ s/$search//;
    print $input;

    But this does not work. It looks like there is some confusion with the
    special characters :, \ .
    Can somebody tell me what's wrong and how do I fix this?

    Thanks,
    Ashok.


  • Next message: Gunnar Hjalmarsson: "Re: Substitution Problem"