Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Unindenting here-docs (Re: My day with Damian Conway)

by tachyon (Chancellor)
on Jan 31, 2002 at 12:43 UTC ( #142404=note: print w/ replies, xml ) Need Help??


in reply to Unindenting here-docs (Re: My day with Damian Conway)
in thread My day with Damian Conway

sub unindent { my $str = shift; (my $s) = $str =~ m/^(\s+)/; $str =~ s/^$s//gm; return $str; }

This will look at the first line and extract that much leading whitespace from every line so does what you want without the .

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


Comment on Re: Unindenting here-docs (Re: My day with Damian Conway)
Download Code
(tye)Re: Unindenting here-docs (Re: My day with Damian Conway)
by tye (Cardinal) on Jan 31, 2002 at 16:41 UTC

    Um, no, you missed the whole point.

    print unquote( <<" TEST" ); First line Second line Third line Fourth line TEST
    Tell me what that should produce and I'll tell you what my tab stops were set to and that you were wrong. :) (And don't be fooled by how your browser happens to display that code.)

            - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-07-31 10:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (248 votes), past polls