Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Incredibly stupid substitution question :(

by viffer (Beadle)
on Aug 11, 2010 at 07:26 UTC ( #854248=note: print w/replies, xml ) Need Help??


in reply to Re: Incredibly stupid substitution question :(
in thread Incredibly stupid substitution question :(

when I do print, yes it does give me that,
looking through perl debug it gives me
Kev\\.has\\.a\\.stupid\\.perl\\.question'

maybe it's just how it shows up in debug. Cheers

  • Comment on Re^2: Incredibly stupid substitution question :(

Replies are listed 'Best First'.
Re^3: Incredibly stupid substitution question :(
by roboticus (Chancellor) on Aug 11, 2010 at 10:10 UTC

    viffer:

    How are you displaying it under the debugger? I'm seeing the expected value (using perl v5.10.1 under cygwin):

    roboticus@Boink:~$ cat 854238.pl my $text = "Kev.has.a.stupid.perl.question"; $text =~ s/\./\\./g; $text .= "."; print $text; roboticus@Boink:~$ perl 854238.pl Kev\.has\.a\.stupid\.perl\.question. roboticus@Boink:~$ perl -d 854238.pl ...snip... main::(854238.pl:1): my $text = "Kev.has.a.stupid.perl.question"; DB<1> b 3 DB<2> r main::(854238.pl:3): $text .= "."; DB<2> p $text Kev\.has\.a\.stupid\.perl\.question DB<3>

    ...roboticus

      using x $text rather than print $text
      ie
      my $text = "Kev.has.a.stupid.perl.question"; DB<1> x $text 0 'Kev.has.a.stupid.perl.question' $text =~ s/\./\\./g; DB<2> x $text 0 'Kev\\.has\\.a\\.stupid\\.perl\\.question'

        viffer:

        Interesting ... I've never noticed that the x command and the p command give different results for a string in the debugger. A quick browse of perldebug didn't give me any obvious hints...

        ...roboticus

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://854248]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-05-18 12:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (70 votes). Check out past polls.

    Notices?