BmSoftCo has asked for the wisdom of the Perl Monks concerning the following question:

I am using SOAP::Lite to communicate with Server. As part of communication (authorization) Server will send to me challenged value (needs to be 8 characters) an I need encrypt that value with my personal Encrypt Key and resend it to get additional data from server. Everything is going OK until I get challenged value which contains pair // characters. In most cases string is now 9 characters long. I am using Data::Dumper to save data from the Server and searching for specific tags to extract that value. Please help! Milan

Replies are listed 'Best First'.
Re: Problem with \\
by ww (Archbishop) on Oct 20, 2010 at 01:21 UTC
    And the code which produces this undesired behavior is...
                where?
Re: Problem with \\
by aquarium (Curate) on Oct 20, 2010 at 02:13 UTC
    as there's no code to look at...i guess you need to more carefully quote the variables to do with this challenge, so the two forward slashes are not evaluated by perl to be a matching call, or a (string) meta-character, or other perl interpretation. if this is the case then the appropriate quoting mechanism should help. Please note that your question title is about backslashes, and description is about forward slashes. i tried to cover both, and until otherwise convinced, i think they cause similar (quoting) problem.
    the hardest line to type correctly is: stty erase ^H
Re: Problem with \\
by Anonymous Monk on Oct 20, 2010 at 01:23 UTC
Re: Problem with \\
by CountZero (Bishop) on Oct 20, 2010 at 12:38 UTC
    <crystal-ball mode=on>Most probably Data::Dumper is the wrong way to get at the data. This module tend to escape various "special" characters so as to enable it to later reconstitute the original data.

    A single "\" gets encoded or escaped as a double "\\" and therefore your challenge string unexpectedly has grown to be 9 characters long.<crystal-ball mode=off>

    use strict; use warnings; use Data::Dumper; my $test = '123\456'; print Dumper($test);
    Output is
    $VAR1 = '123\\456'

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James