SPUG: A little style question....

Aaron Salo aaron_j_salo at yahoo.com
Tue Sep 19 20:03:18 CDT 2000

--- Stephen Nickels <snickels at u.washington.edu> wrote:
> is: here docs, good
> or bad?

::starting a holy war::
      - bad -

Use qq() instead and you get great taste and less
filling in the same bottle...

my $output = qq(Hey, y'all,<BR>
is the SILLIEST "thing" 
I ever <SPAN CLASS="bigandbold">heard</SPAN> 
& I really mean it!!!);

escapes all your HTML and your quotes and your
punctuation very nicely, also carries your newlines
forward as well...

> Line-delimited
> things like here docs
> break this rule of his quite severly.

Agreed. With qq() you have delimiting characters not
prone to the python-esque malfunction (not to mention
debugging headache) of arbitrary line formations. You
can use any delimiting character you like, I generally
prefer parens. However, if you're writing SQL you
might not want to use parens:

$sql = qq^
SET foo = 'bar',
bar = 'foo'
WHERE account_number in
(SELECT account_number FROM bar
where username = 'here_doc')

very tidy.


-If this is from Yahoo, that means I'm on the road-
Aaron Salo
aaron at activox.com

Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/

More information about the spug-list mailing list