|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
hi..
how can I do this: $inVar = "this is a string with both " and ' in it which will probably confuses the perl engine"; I could have added slashes by hand.. but the above string is 2000 lines long in my program.. I tried using quotemeta but it didn't work either... no.. I don't want to store it in a file.. and then do it.. I want to be able to do this within the same file... how can it be done? |
|
#2
|
|||
|
|||
|
Use:
$inVar = qq/this is a string with both " and ' in it which will probably confuses the perl engine/; If you have / characters occuring in your string, use some other delimiter (e.g ~ or !) -- basically, just pick some non-whitespace, non-alphanumeric character that doesn't occur in your string. If there is no such character, then you'll have to escape any characters that match your delimiter (i.e. if you use " as a delimiter you must replace all occurences of " in the string with ", or if you use / you'd have to replace it with /). One note is that if you're not interpolating variables in that string, you should use single quotes or the q// operator, as that doesn't attempt to do any variable interpolation and so runs a lot faster. If you don't entirely understand what I'm talking about, run: perldoc perlop and go to the section entitled: Quote and Quote-like Operators |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > perl var issue |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|