> > Alex, you might want to explain to people (such as myself)
> > who don't know how Perl etc decide how much white space to insert
> > in the string that's broken across a line.  One space?  None?
> > What of the indentation spaces on the new line?   What if
> > you really want those spaces to appear in the string?
[..]
> #!/usr/bin/perl
> 
> print "hello 
>   world\n";

I never use multi-line strings in this form; instead I use the "here-document" form:

#!/usr/bin/perl

print <<EOF;
hello
  world
EOF

Here the "<<token" is replaced by the string consisting of everything between the 
start of the next line and the first occurrence of the token at the beginning of a 
line (IIRC).  Like this, you get substitution in the string (for character escapes and 
variables); if you write

print <<'EOF';
hello
  world
EOF

instead you get no substitution of escapes or variables; backslashes, dollar signs, at 
signs etc are left untouched.

I find this a bit cleaner than looking for four matching pixels possibly pages below.

--KW 8-)
-- 
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) ------------------------:
: PhD Student, Computer Laboratory, University of Cambridge, England. :
:  (and recently of the University of Glasgow, Scotland. [><] )       :
: Native of Antipodean Auckland, New Zealand: 174d47' E, 36d55' S.    :
: http://www.cl.cam.ac.uk/users/kw217/  mailto:[EMAIL PROTECTED]     :
:---------------------------------------------------------------------:




Reply via email to