Groups | Search | Server Info | Login | Register
Groups > comp.lang.perl.misc > #4803
| From | Uri Guttman <uri@stemsystems.com> |
|---|---|
| Newsgroups | comp.lang.perl.misc |
| Subject | Re: Embedding code in qq{}? |
| Date | 2012-03-19 00:12 -0400 |
| Organization | albasani.net |
| 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> |
>>>>> "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 | Next — Previous in thread | Next in thread | Find similar
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