Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Here docs throwing syntax error - can't find string terminator

by shmem (Chancellor)
on May 29, 2007 at 22:17 UTC ( [id://618064]=note: print w/replies, xml ) Need Help??


in reply to Here docs throwing syntax error - can't find string terminator

For here-doc terminators, leading blanks are whitespace is meaningful. Insert the same amount of blanks in your print statement leading delimiter, e.g.
use strict; my $stuff = join(":", <<" END" =~ /(.+)/g); hi there this\tis\ta\ttest of the best! END

or (better) remove the leading blanks from the end token.

update: strikes for better wording, and changed '        END' to "        END". Well...

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: Here docs throwing syntax error - can't find string terminator
by ikegami (Patriarch) on May 30, 2007 at 16:05 UTC

    You used 'END' where you should have used "END".

    print <<END, <<'END', <<"END"; abc\tdef END abc\tdef END abc\tdef END

    outputs

    abc def abc\tdef abc def

    <<END is equivalent to <<"END" and not equivalent to <<'END', so the OP needs <<"        END" rather than <<'        END'.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-23 14:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found