Sponsor for PC Pals Forum

Author Topic: Very small perl question  (Read 3994 times)

Offline Foxy

  • New Member
  • *
  • Posts: 3
Very small perl question
« on: January 06, 2003, 11:59 »
Whats the way to have a double quote (") in a Perl string without Perl thinking that it's the end of the string? I need this for CGI.

Offline Corky

  • Regular Member
  • **
  • Posts: 87
    • http://www.faceparty.com/corky_wales
Re:Very small perl question
« Reply #1 on: January 06, 2003, 12:07 »
Hi Foxy,

I think its "txt"
img]http://www.raid-designs.co.uk/emote/corkypc.gif[/img]

Adept

  • Guest
Re:Very small perl question
« Reply #2 on: January 06, 2003, 13:21 »
It's the same in PHP isn't it Corky?

Offline Corky

  • Regular Member
  • **
  • Posts: 87
    • http://www.faceparty.com/corky_wales
Re:Very small perl question
« Reply #3 on: January 06, 2003, 13:38 »
I think so..  I haven't had many encounters with PERL (thank god) ;D

Most of the scripting langs use the same style syntax so it should be ok.
img]http://www.raid-designs.co.uk/emote/corkypc.gif[/img]

Offline DJ

  • Established Member
  • ****
  • Posts: 1448
Re:Very small perl question
« Reply #4 on: January 06, 2003, 15:08 »
Yep scripting in perl for cgi it is as Corky says...

"txt"

 have a look at

http://www.steve.gb.com/perl/lesson01.html for examples.

DJ1UK

Offline DualBoy

  • Regular Member
  • **
  • Posts: 96
    • http://www.pingme.ca
Re:Very small perl question
« Reply #5 on: January 07, 2003, 10:24 »
I have posted some old lessons I had back in University on Unix and CGI/Perl also bash and some stuff on grep and much more:

http://www.travisjmac.com/unix/

Chapters 7 thru 11 will give you a good understanding of Perl and its not a very long read either. You can probably skim thru each chapter in about 20-30 minutes and feel free to write some basic code to test strings, arrays and much more.

Offline DualBoy

  • Regular Member
  • **
  • Posts: 96
    • http://www.pingme.ca
Re:Very small perl question
« Reply #6 on: January 07, 2003, 10:27 »
In many languages it is rather cumbersome to include in a quoted string the same quote mark being used to delimit the string. In Perl, as in C, you can use the backslash quote mechanism (in both single and double-quoted strings):

 $dstrng = "this is a "-quoted string
";
 $sstrng = 'this is a '-quoted string';     # can't do
 though
 
but this gets tiresome if there's more than one embeded quote. Perl also provides a completely different syntax for creating strings, which is exactly equivalent to the more usual forms:
 $dstrng = qq{this is a "-quoted string
};  # qq is same as "
 $sstrng = q{this is a '-quoted string};     # q is same as '
 $bstrng = qx{grep '^dualboy:' /etc/passwd};   # qx is same as `

Offline bat69

  • Loyal Member
  • *****
  • Posts: 1951
    • http://members.lycos.co.uk/dbat69/
Re:Very small perl question
« Reply #7 on: January 07, 2003, 12:30 »
Thanks DB ... there is an awful lot of very good stuff there to read, infact just what I've been looking for so I can start to learn more about coding  8)
url=http://www.pc-pals.com/userpics/bat69bc.swf]Flash[/url]

Offline DualBoy

  • Regular Member
  • **
  • Posts: 96
    • http://www.pingme.ca
Re:Very small perl question
« Reply #8 on: January 07, 2003, 18:57 »
No problem. I Have lots of stuff in PDF file format on Linux and PHP and many other langs. Also some old computer contests and such taht are fun to do once your more into programming.

Offline bat69

  • Loyal Member
  • *****
  • Posts: 1951
    • http://members.lycos.co.uk/dbat69/
Re:Very small perl question
« Reply #9 on: January 07, 2003, 19:19 »
Sounds great ... need to get off the ground first  :- tho, but its something I aim to do. That is one of the reasons I want to install Linux, so I have more incentive to dabble ... used to do lots of programming at school/college, but that was a long time ago, and haven't used it since.
url=http://www.pc-pals.com/userpics/bat69bc.swf]Flash[/url]


Show unread posts since last visit.
Sponsor for PC Pals Forum