Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!news.albasani.net!.POSTED!not-for-mail From: Uri Guttman 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> References: <87limyk471.fsf@Gmail.com> <87ty1lu2z7.fsf@stemsystems.com> <87pqc9trvt.fsf@stemsystems.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 >>>>> "TM" == Tim McDaniel writes: TM> In article <87pqc9trvt.fsf@stemsystems.com>, TM> Uri Guttman wrote: >>>>>>> "TM" == Tim McDaniel writes: >> TM> In article <87ty1lu2z7.fsf@stemsystems.com>, TM> Uri Guttman 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