Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Simulate a head lice infection

by johngg (Canon)
on Jan 23, 2009 at 22:57 UTC ( #738612=note: print w/replies, xml ) Need Help??


in reply to Re^2: Simulate a head lice infection
in thread Simulate a head lice infection

One way you can indent HEREDOCs is to substitute the leading spaces in a map.

$ perl -e ' $x = 1; if( $x ) { print map { s{^ }{}gm; $_ } <<" EOT"; Line 1 Line 2 \$x is $x Line 4 EOT }' Line 1 Line 2 $x is 1 Line 4 $

This really is not a serious suggestion. It is rather horrible, probably inefficient and it would be a nightmare to maintain in a script. It would easily break if code is moved around and logical depth (thus indentation) changes or if you use an editor that decides off its own bat to use tabs instead of spaces when auto-indenting.

I just post the code as a curio. Downvote if nauseated.

Cheers,

JohnGG

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2021-11-30 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?