SPUG: Re: for-here; sub interpolation

El JoPe Magnifico jope-spug at n2h2.com
Tue Sep 19 19:06:48 CDT 2000

I've long pined for a tab-removal option for perl's for-here operator,
as is found in the implementation in bash and possibly other shells:

If the delimiter is preceded by a hyphen, ignore all leading tabs,
up to and including the delimiter.  I find this to be an enormous 
help, allowing you to avoid interrupting your code indentation.
Sample usage, if this were added to perl:

  $quote = <<-DELIMITER;
    this text will not be indented
    when you use it later

The alternative, which they're still propping up in the third edition
of the camel book, is cumbersome, inefficient, and still requires you
to keep your delimiter flush to the left:

  ($quote = <<DELIMITER) =~ s/^\s+//gm;
    this text will not be indented
    when you use it later

Yeah, yeah, I know: Hack it in myself.  Not today.  =) =)

Speaking of no-brainers, here's an unrelated quoting question:

Has interpolation of &subroutine_name inside double quotes been
added recently?  Derhaag's 5.6 build on Solaris apparently
provided that ability, but I couldn't find any mention of it
in the new camel book or online, nor could I reproduce with the
5.004 or 5.5 builds I had available to me.

Actually a handy feature, when I thought about it, and natural
given that $scalar_name and @list_name already interpolate.
Gotta wonder why that hasn't been available since day one.
Instead, I end up doing @{[subroutine_name]} which isn't too bad,
but not particularly intuitive.

On Tue, 19 Sep 2000, James Munger wrote:
> All this said, I find here documents to be much
> more readable than anything else.  If there's a
> block of interpreted text to be had, they do
> the trick.  However, they clash with the
> [indentation] style of my code.  After having
> settled into this style, I've decided that the
> break in aethetics is worth the tradeoff of
> readability.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     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