Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.perl.misc > #4803

Re: Embedding code in qq{}?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!news.albasani.net!.POSTED!not-for-mail
From Uri Guttman <uri@stemsystems.com>
Newsgroups comp.lang.perl.misc
Subject Re: Embedding code in qq{}?
Date Mon, 19 Mar 2012 00:12:26 -0400
Organization albasani.net
Lines 78
Message-ID <87d389tej9.fsf@stemsystems.com> (permalink)
References <87limyk471.fsf@Gmail.com> <87ty1lu2z7.fsf@stemsystems.com> <jk5nsj$ot8$2@reader1.panix.com> <87pqc9trvt.fsf@stemsystems.com> <jk677e$9vk$1@reader1.panix.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace news.albasani.net LWThud6dJPTp5KCSsTlPoGKFzoxIWP0MD7qytebJYkbjzPLY+gKxyt8aa4TqJGfzHMuqPdDzsRgf9iBqrDNXYA/SgKEpCxPpQ0WtA7MaFe+33f1EXllES5/ha5QL+A3t
NNTP-Posting-Date Mon, 19 Mar 2012 04:13:10 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="OnUhif8ryyn1/vtf+pq9X0gaharLen+8/oa6nlJ8eJNLo9CaNETSSYGOPn4b1ap0OtJ68/fWxgEZhWIPdMXvBCvSmEIOGsASuhKjcuuubooJKQv7feNSo4hG9Zmla3ze"; mail-complaints-to="abuse@albasani.net"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Cancel-Lock sha1:ujVDIfOC2pDAWH3czkT34UcpEvk= sha1:ZaabM9duZ5wo6QqhRLMZVgFSEpQ=
Xref csiph.com comp.lang.perl.misc:4803

Show key headers only | View raw


>>>>> "TM" == Tim McDaniel <tmcd@panix.com> writes:

  TM> In article <87pqc9trvt.fsf@stemsystems.com>,
  TM> Uri Guttman  <uri@stemsystems.com> wrote:
  >>>>>>> "TM" == Tim McDaniel <tmcd@panix.com> writes:
  >> 
  TM> In article <87ty1lu2z7.fsf@stemsystems.com>,
  TM> Uri Guttman  <uri@stemsystems.com> wrote:
  >> >> bad answer.  first off it isn't needed as the /e modifier to
  >> >> s/// does it.
  >> 
  TM> Which I tried to make clear but didn't.  I wasn't trying to
  TM> address the s/// case; everyone who pointed out s///e covered
  TM> it quite nicely.  I was trying to cover the case of being
  TM> outside the RHS of s///.
  >> 
  >> but the OP was only really asking about s///.

  TM> I'm not allowed to bring up new stuff?  I'm only allowed to address
  TM> the one case that someone asks about and not tangent off onto
  TM> something else?

you can but it wasn't clear (as you said) that it was additional
stuff. and it wasn't the best stuff IMO either. 

  TM> And in any event, it works on the right-hand side of s///:

who ever said it wouldn't work there? the replacement side is a ""
string with some slight differences. but /e is better anyhow.

  TM> To repeat again, man perlref says it is.

  TM>     Anywhere you'd put an identifier (or chain of identifiers) as part
  TM>     of a variable or subroutine name, you can replace the identifier
  TM>     with a BLOCK returning a reference of the correct type.

  >> the more i think about it, it isn't a true block in general. it is a
  >> dereference operation that allows statements. you can't last out of
  >> it

  TM> "Being able to last out of it" is not Perl's definition of block.
  TM> man perlsyn says

  TM>     In Perl, a sequence of statements that defines a scope is called a
  TM>     block.  Sometimes a block is delimited by the file containing it
  TM>     (in the case of a required file, or the program as a whole), and
  TM>     sometimes a block is delimited by the extent of a string (in the
  TM>     case of an eval).

  TM>     But generally, a block is delimited by curly brackets, also known
  TM>     as braces.  We will call this syntactic construct a BLOCK.

and in most brace blocks you can last out. you can't in a dereference
block. hence it isn't the same as the others. you can't do various
things in the various types of blocks. it is good to know the difference
vs thinking they are all the same blocks. 

  >> (which you can from a bare block).

  TM> "last" is specifically a *loop* control structure, and a bare block,
  TM> as the perlfunc do docs says

  TM>     "do BLOCK" does not count as a loop, so the loop control
  TM>     statements "next", "last", or "redo" cannot be used to leave or
  TM>     restart the block.  See perlsyn for alternative strategies.

  TM> man perlsyn explains:

  TM>     A BLOCK by itself (labeled or not) is semantically equivalent to a
  TM>     loop that executes once.  Thus you can use any of the loop control
  TM>     statements in it to leave or restart the block.  (Note that this
  TM>     is NOT true in "eval{}", "sub{}", or contrary to popular belief
  TM>     "do{}" blocks, which do NOT count as loops.)  The "continue" block
  TM>     is optional.

and it doesn't say the ${} block is either case. 

uri

Back to comp.lang.perl.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Embedding code in qq{}? XeCycle <XeCycle@Gmail.com> - 2012-03-18 10:56 +0800
  Re: Embedding code in qq{}? Uri Guttman <uri@stemsystems.com> - 2012-03-17 23:04 -0400
    Re: Embedding code in qq{}? XeCycle <XeCycle@Gmail.com> - 2012-03-18 12:14 +0800
  Re: Embedding code in qq{}? tmcd@panix.com (Tim McDaniel) - 2012-03-18 07:07 +0000
    Re: Embedding code in qq{}? Ben Morrow <ben@morrow.me.uk> - 2012-03-18 08:37 +0000
      Re: Embedding code in qq{}? tmcd@panix.com (Tim McDaniel) - 2012-03-18 22:28 +0000
        Re: Embedding code in qq{}? merlyn@stonehenge.com (Randal L. Schwartz) - 2012-03-18 16:18 -0700
          Re: Embedding code in qq{}? tmcd@panix.com (Tim McDaniel) - 2012-03-19 02:21 +0000
            Re: Embedding code in qq{}? Uri Guttman <uri@stemsystems.com> - 2012-03-19 00:14 -0400
              Re: Embedding code in qq{}? tmcd@panix.com (Tim McDaniel) - 2012-03-19 06:42 +0000
                Re: Embedding code in qq{}? Ben Morrow <ben@morrow.me.uk> - 2012-03-19 16:40 +0000
        Re: Embedding code in qq{}? Uri Guttman <uri@stemsystems.com> - 2012-03-18 19:29 -0400
    Re: Embedding code in qq{}? Uri Guttman <uri@stemsystems.com> - 2012-03-18 15:24 -0400
      Re: Embedding code in qq{}? tmcd@panix.com (Tim McDaniel) - 2012-03-18 22:33 +0000
        Re: Embedding code in qq{}? Uri Guttman <uri@stemsystems.com> - 2012-03-18 19:24 -0400
          Re: Embedding code in qq{}? Ben Morrow <ben@morrow.me.uk> - 2012-03-19 00:49 +0000
            Re: Embedding code in qq{}? Uri Guttman <uri@stemsystems.com> - 2012-03-18 22:05 -0400
          Re: Embedding code in qq{}? tmcd@panix.com (Tim McDaniel) - 2012-03-19 02:55 +0000
            Re: Embedding code in qq{}? Uri Guttman <uri@stemsystems.com> - 2012-03-19 00:12 -0400
              Re: Embedding code in qq{}? tmcd@panix.com (Tim McDaniel) - 2012-03-19 07:00 +0000
                Re: Embedding code in qq{}? Ben Morrow <ben@morrow.me.uk> - 2012-03-19 16:43 +0000

csiph-web