Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Formatting quotes in a String

by Laurent_R (Canon)
on Dec 01, 2016 at 10:13 UTC ( [id://1177030]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Formatting quotes in a String
in thread Formatting quotes in a String

.can you please get me through how this is working
Your tests are not adequate to understand choroba's suggested code. Try this (demonstrated here under the Perl debugger):
DB<1> $string = 'Tetsing " code implementationm'; DB<2> $result = $string =~ tr/"//; DB<3> p $result 1 DB<4> p $string Tetsing " code implementationm
In essence, choroba is testing the value that ends up into $result in the code above. And it adds a quote mark at the end of the string if the value returned by tr/// is odd (meaning that quote marks are unbalanced).

Replies are listed 'Best First'.
Re^4: Formatting quotes in a String
by pavan474 (Novice) on Dec 02, 2016 at 12:07 UTC

    Thanks, Laurent_R

    I got how this is working

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-23 15:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found