[32242] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3509 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 1 06:09:31 2011

Date: Sat, 1 Oct 2011 03:09:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 1 Oct 2011     Volume: 11 Number: 3509

Today's topics:
    Re: $_ or @_ in subrountine? <ela@yantai.org>
    Re: A Spurious Warning <rweikusat@mssgmbh.com>
    Re: A Spurious Warning <jwkrahn@example.com>
    Re: A Spurious Warning (Alan Curry)
    Re: A Spurious Warning <tzz@lifelogs.com>
    Re: A Spurious Warning <tzz@lifelogs.com>
    Re: A Spurious Warning <rweikusat@mssgmbh.com>
    Re: A Spurious Warning <mvdwege@mail.com>
    Re: A Spurious Warning <rweikusat@mssgmbh.com>
    Re: A Spurious Warning <jurgenex@hotmail.com>
        HEKLPO <r@thevoid1.net>
        perl module for context grammar? <ela@yantai.org>
    Re: perl module for context grammar? <jimsgibson@gmail.com>
    Re: perl module for context grammar? <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: perl module for context grammar? <ela@yantai.org>
    Re: perl module for context grammar? <ela@yantai.org>
    Re: perl module for context grammar? sln@netherlands.com
    Re: question about speed of sequential string replaceme <john@castleamber.com>
        so stop problematic <r@thevoid1.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 30 Sep 2011 22:16:56 +0800
From: "ela" <ela@yantai.org>
Subject: Re: $_ or @_ in subrountine?
Message-Id: <j64j1e$trm$1@ijustice.itsc.cuhk.edu.hk>


"Tad McClellan" <tadmc@seesig.invalid> wrote in message
> I pointed this out to you a couple of years ago, yet here
> you are still doing it...

Sorry for my late reply because when the first reply had appeared, I 
immediately checked the reference and fixed the error. Again, I wish to 
emphasize that I'm poor at organizing knowledge learnt and not intentively 
ignore your kind advice. I'm still struggling to better myself and I hope I 
can be one day fully qualified as a poster. 




------------------------------

Date: Wed, 28 Sep 2011 22:22:27 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: A Spurious Warning
Message-Id: <87bou4icq4.fsf@sapphire.mobileactivedefense.com>

pacman@kosh.dhis.org (Alan Curry) writes:
> In article <87fwjgih8s.fsf@sapphire.mobileactivedefense.com>,
> Rainer Weikusat  <rweikusat@mssgmbh.com> wrote:
>>I've been arguing that well-defined default values for not otherwise
>>initialized variables are a good thing because this is a useful
>>feature and one which is 'logically sensible' (that was the statement
>>about 'null values' getting interpreted as 'something sensible'
>>depending on the use they are going to be put to: Asking wheter a null
>>value is defined should yield the answer 'no'. It should count as
>>'false'. Interpreted as a string, it should be regarded as an empty
>>string. Used as a number, the value should be 0). And I haven't
>>invented this: The same behaviour was obviously also considered
>>sensible by the people who wrote the corresponding compiler/
>>interpreter code because this is how 'undefined values' will be
>>interpreted, depending on the uses they are being put to.
>>
>>In short: Perl has some features you HATE !!!!. You try to overcome
>>that by attacking people who claim they are useful => you are a troll.
>
> From the amount of energy involved in your persistent posts, it sure looks
> like you're the one who HATE!!!!s the fact that perl warns about certain uses
> of undef,

But perl doesn't warn about 'certain uses of undef': Provided someone
goes to the length of unconditionally enabling all run-time warnings
perl is capable of generating, this particular warning will also be
enabled. 

[...]

> Think about this from another angle: is it a useful feature, in programming
> lanugages generally, to have a value which causes an exceptional runtime
> event (warning/death/coredump/takeyourpick) when it is used? I think
> so. That's how most of us use undef. 

But - your argument-unsupported opinion on that notwithstanding
- Perl doesn't have such a value. Instead, it has another kind of
'null value' with a different set features which are useful for
other situations. But if the language doesn't support some feature you
consider essential, and if you're into this type of 'theoretical
arguments about how things should really be instead of how they are',
why don't you just add your feature to the language and leave features
other people have found to be useful for them alone?

And if this can't be done (which is the case here), why don't you
simply use a language providing what you would like to have instead?
It's not that there would be a shortage of 'maximally
anally-retentative runtime environmens' ever since the misconception
that these would be essential came up 40 years ago

> Your way is more like the original intent of That's how most of us
> use undef. Your way is more like the original intent of undef, as
> proven by the ancient documentation you keep quoting,

The presently most current perl version is 5.14.2. The most current
online version of the documentation (I was able to find without
spending much time on searching for it) is for 5.14.1. The manpage I
have been quoting in this thread is available here:

	http://perldoc.perl.org/perldata.html

And it contains the exact text I quoted. Consequently, you statement
about 'ancient documentation' is factually incorrect, at least in this
context.


------------------------------

Date: Wed, 28 Sep 2011 15:40:01 -0700
From: "John W. Krahn" <jwkrahn@example.com>
Subject: Re: A Spurious Warning
Message-Id: <6nNgq.5$aq6.2@newsfe11.iad>

Rainer Weikusat wrote:
> Below is a Perl subroutine supposed to parse a CIDR IPv4 network
> specification and return the numerical values of the first and last
> addresses in this range (this code is (c) my employer and quoted here
> for educational purposes):
>
> sub parse_net_spec($)
> {
>      my ($first, $mask, @octets, $prefix);
>
>      $_[0] =~ /^((?:\d{1,3}\.){0,3}\d{1,3})\/(\d\d?)$/&&  do {
> 	$prefix = $2;
> 	die('prefix too large') unless $prefix<  33;
>
> 	@octets = split(/\./, $1);
> 	for (@octets) {
> 	    die('octet too large') unless $_<  256;
> 	    $first = $first<<  8 | $_;
> 	}
> 	$first<<= 8 * (4 - @octets);

You are missing a semi-colon (;) between the end of the do{} block and 
the next statement.


>
> 	$mask = (1<<  (32 - $prefix)) - 1;
> 	return ($first&  ~$mask, $first | $mask);
>      };
>
>      die("'$_[0]' does not look like a CIDR network specification");
> }


John
-- 
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein


------------------------------

Date: Thu, 29 Sep 2011 03:09:07 +0000 (UTC)
From: pacman@kosh.dhis.org (Alan Curry)
Subject: Re: A Spurious Warning
Message-Id: <j60ngj$dq2$1@speranza.aioe.org>

In article <87bou4icq4.fsf@sapphire.mobileactivedefense.com>,
Rainer Weikusat  <rweikusat@mssgmbh.com> wrote:
>pacman@kosh.dhis.org (Alan Curry) writes:
>
>> Your way is more like the original intent of That's how most of us
>> use undef. Your way is more like the original intent of undef, as
>> proven by the ancient documentation you keep quoting,
>
>The presently most current perl version is 5.14.2. The most current

This specific sentence of documentation:

  There are actually two varieties of null string: defined and undefined.

was present in the man page for perl 3.0. Despite its survival in the current
version of perldata(1), it *is* ancient. Nobody would call the undefined
value a "variety" of a "null string" if they were writing the documentation
today.

-- 
Alan Curry


------------------------------

Date: Thu, 29 Sep 2011 12:30:58 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: A Spurious Warning
Message-Id: <87d3ejgsrx.fsf@lifelogs.com>

On Wed, 28 Sep 2011 20:02:51 +0100 Rainer Weikusat <rweikusat@mssgmbh.com> wrote: 

RW> A null string (no matter if defined or undefined) "isn't a number",
RW> hence, its numerical value is 0.

I don't know how you arrived at that conclusion.  Are you aware "infinity"
is not a number either?  How about "minus infinity"?

Ted


------------------------------

Date: Thu, 29 Sep 2011 12:32:00 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: A Spurious Warning
Message-Id: <878vp7gsq7.fsf@lifelogs.com>

On Wed, 28 Sep 2011 20:44:51 +0100 Rainer Weikusat <rweikusat@mssgmbh.com> wrote: 

RW> In short: Perl has some features you HATE !!!!. You try to overcome
RW> that by attacking people who claim they are useful => you are a troll.

Yup, that about sums it up.  Nice job, Rainer.

Ted


------------------------------

Date: Thu, 29 Sep 2011 19:20:11 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: A Spurious Warning
Message-Id: <87ehyz1a90.fsf@sapphire.mobileactivedefense.com>

"John W. Krahn" <jwkrahn@example.com> writes:
> Rainer Weikusat wrote:
>> Below is a Perl subroutine supposed to parse a CIDR IPv4 network
>> specification and return the numerical values of the first and last
>> addresses in this range (this code is (c) my employer and quoted here
>> for educational purposes):
>>
>> sub parse_net_spec($)
>> {
>>      my ($first, $mask, @octets, $prefix);
>>
>>      $_[0] =~ /^((?:\d{1,3}\.){0,3}\d{1,3})\/(\d\d?)$/&&  do {
>> 	$prefix = $2;
>> 	die('prefix too large') unless $prefix<  33;
>>
>> 	@octets = split(/\./, $1);
>> 	for (@octets) {
>> 	    die('octet too large') unless $_<  256;
>> 	    $first = $first<<  8 | $_;
>> 	}
>> 	$first<<= 8 * (4 - @octets);
>
> You are missing a semi-colon (;) between the end of the do{} block and
> the next statement.
>
>
>>
>> 	$mask = (1<<  (32 - $prefix)) - 1;
>> 	return ($first&  ~$mask, $first | $mask);
>>      };

The end of the do-block is in the line above and I hope the
semicolon is clearly visible :-).


------------------------------

Date: Fri, 30 Sep 2011 09:31:51 +0200
From: Mart van de Wege <mvdwege@mail.com>
Subject: Re: A Spurious Warning
Message-Id: <864nzuv63c.fsf@gareth.avalon.lan>

Rainer Weikusat <rweikusat@mssgmbh.com> writes:

> In short: Perl has some features you HATE !!!!.  You try to overcome
> that by attacking people who claim they are useful => you are a troll.

Well, if you attack people instead of arguments, then yes, you are a
troll.

Mart

-- 
"We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.


------------------------------

Date: Fri, 30 Sep 2011 17:36:30 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: A Spurious Warning
Message-Id: <87ehyyugvl.fsf@sapphire.mobileactivedefense.com>

pacman@kosh.dhis.org (Alan Curry) writes:
> Rainer Weikusat  <rweikusat@mssgmbh.com> wrote:
>>pacman@kosh.dhis.org (Alan Curry) writes:
>>
>>> Your way is more like the original intent of That's how most of us
>>> use undef. Your way is more like the original intent of undef, as
>>> proven by the ancient documentation you keep quoting,
>>
>>The presently most current perl version is 5.14.2. The most current
>
> This specific sentence of documentation:
>
>   There are actually two varieties of null string: defined and undefined.
>
> was present in the man page for perl 3.0. Despite its survival in the current
> version of perldata(1), it *is* ancient. Nobody would call the undefined
> value a "variety" of a "null string" if they were writing the documentation
> today.

Despite your attempts to weasel-word around this based on assumptions
about what hypothetical people would have done had they done something
(which I take as 'I [meaning, you] had never written that' [because I
want to bury this feature of Perl so that people obey to the arbitrary
other usage policy I'd like to force onto them'), whatever is
currently contained in the documentation is not 'ancient' but
'current' even although it may have been there 'since ancient times',
IOW, as I wrote in another posting, 'it has always been in this way'.

Something I really don't understand here is how the fact that some
people know the (technical) truth that perl assigns a sensible, useful
default value to newly created variables and consequently, write code
exploiting this feature, affects your ability to pretend that it
wasn't so (for a reason you didn't care to name). Why do you think
other people have to be conned into assuming that things are how you
would have liked them to be? And why does this difference in opinion
warrant attacking people with as much vitriol and 'threats of serious
real-life consequences' a la Mr Guttman as possible just for telling
the truth?







------------------------------

Date: Sat, 01 Oct 2011 02:35:32 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: A Spurious Warning
Message-Id: <7umd87prrmg2ooojf62o0a73a899u58ts9@4ax.com>

Rainer Weikusat <rweikusat@mssgmbh.com> wrote:
>Charlton Wilbur <cwilbur@chromatico.net> writes:
>>>>>>> "RW" == Rainer Weikusat <rweikusat@mssgmbh.com> writes:
>>
>>     RW> This will, of course, given a suitably adjusted perl invocation,
>>     RW> result in a
>>
>>     RW> Use of uninitialized value $first in left bitshift (<<)
>>
>>     RW> warning, despite the automatic conversion which is going to take
>>     RW> place here will result in the correct value (0).
>>
>>     RW> What was the precise reason why this is supposed to be
>>     RW> 'something that should not be'?
>>
>> Generally, performing arithmetic on undefined values is a sign of an
>> error or an omission.
>
>Given that this is a well-defined operation and has always been one,
>this statement seems unjustifiable to me. Especially since a newly
>created variable with no explicitly assigned other value will start
>its 'arithmetic life' as zero and this is obviously useful whenever
>some series of arithmetic operations involving said variable is
>supposed to start with a value of zero.

Just because Perl garantees a well-defined semantic to a specific
construct doesn't imply that it is a good idea to use it. 

With the same argument you could refuse to use declarations because Perl
will automatically create a variable with first use. Nevertheless
hopefully there aren't many people who deny the usefulness of "my".

Or modules or indentations in Perl code. You can write any program
happily without them but luckily only very few people do.
 
>As I wrote in a past posting: This is a feature I have always liked in
>Perl because it means explicit initialization is not necessary when 'a
>null value' of some suitable type is all that is needed (meaning,
>something which is ether undefined, false, 0 or '', depending on what
>use it is supposed to be put to).

If people never make mistakes then you wouldn't need variable
declarations, either. 
But people do make mistakes and the additional cost of writing 
	my $var = 0 
instead of 
	my $var
is so tiny that there is really no reason to ever risk wondering 5
months later if you did mean to use 0 or if you forgot to initialize it
to the correct value and 0 only happens to work in most cases. 
Or worse: having someone else wondering and spending hours to
investigate.

jue


------------------------------

Date: Wed, 28 Sep 2011 15:24:03 -0600
From: robin <r@thevoid1.net>
Subject: HEKLPO
Message-Id: <j6039k$3ap$5@speranza.aioe.org>

making people do stuff,
rights to free speech violation?

it mihtt be

false claims with thought phones?

etc?

it might be.

you never know

keep on doing science hard to do



etc...

need good thought heal phones here

www.thevoid1.net/riel



------------------------------

Date: Fri, 30 Sep 2011 20:07:28 +0800
From: "ela" <ela@yantai.org>
Subject: perl module for context grammar?
Message-Id: <j64bek$rb4$1@ijustice.itsc.cuhk.edu.hk>

While there is another perl module that deals with the following complex 
structure,

(((((((R1441:65.00000000,X29:44.66666667):42.33333333,(R1842:3.00000000,R1909:9.00000000):1.33333333):1.33333333,(R1390:13.00000000,R1505:8.00000000):2.33333333):4.00000000,X122:4.66666667):25.33333333,((CCDC5180:23.00000000,HN878:22.00000000):10.00000000,(CCDC5079:28.00000000,(BT1:28.00000000,BT2:36.00000000):1.00000000):20.00000000):0.00000000):1.00000000,BS1:12.00000000):45.00000000,(R1207:9.00000000,(R1746:40.00000000,((X132:0.00000000,X28:0.00000000):6.50000000,(X156:67.83333333,X85:51.83333333):52.33333333):3.50000000):4.00000000):62.00000000,(kzn4207:6.00000000,(kznR506:3.00000000,kznV2475:2.00000000):8.00000000):245.00000000);

the module does not have the function I need. Is there any standard perl 
module that can allocate the nodes in a hierarchical tree structure (e.g. 
R1441 and X29 are in the same sub-group, and then this sub-group is under 
the same super-group with the subgroup formed by R1842-R1909);
after forming this hierarchical structure, distances between any nodes can 
be easily derived (e.g. the distance of R1441 and X29 is 65+44.67, R1441 and 
R1842 is (65+42.3) + (3+1.3), you can see that if the subgroups are further 
apart, they have to trace more upper level to derive the pairwise distance). 
Another derivation is about intermediate nodes. For example, the distance 
between subgroup R1441-X29 and end node R1909 is 42.3+ (9+1.3)





------------------------------

Date: Fri, 30 Sep 2011 09:32:54 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: perl module for context grammar?
Message-Id: <300920110932542310%jimsgibson@gmail.com>

In article <j64bek$rb4$1@ijustice.itsc.cuhk.edu.hk>, ela
<ela@yantai.org> wrote:

> While there is another perl module that deals with the following complex 
> structure,
> 
>
> (((((((R1441:65.00000000,X29:44.66666667):42.33333333,(R1842:3.00000000,R1909:
> 9.00000000):1.33333333):1.33333333,(R1390:13.00000000,R1505:8.00000000):2.3333
> 3333):4.00000000,X122:4.66666667):25.33333333,((CCDC5180:23.00000000,HN878:22.
> 00000000):10.00000000,(CCDC5079:28.00000000,(BT1:28.00000000,BT2:36.00000000):
> 1.00000000):20.00000000):0.00000000):1.00000000,BS1:12.00000000):45.00000000,(
> R1207:9.00000000,(R1746:40.00000000,((X132:0.00000000,X28:0.00000000):6.500000
> 00,(X156:67.83333333,X85:51.83333333):52.33333333):3.50000000):4.00000000):62.
> 00000000,(kzn4207:6.00000000,(kznR506:3.00000000,kznV2475:2.00000000):8.000000
> 00):245.00000000);
> 
> the module does not have the function I need. Is there any standard perl 
> module that can allocate the nodes in a hierarchical tree structure (e.g. 
> R1441 and X29 are in the same sub-group, and then this sub-group is under 
> the same super-group with the subgroup formed by R1842-R1909);
> after forming this hierarchical structure, distances between any nodes can 
> be easily derived (e.g. the distance of R1441 and X29 is 65+44.67, R1441 and 
> R1842 is (65+42.3) + (3+1.3), you can see that if the subgroups are further 
> apart, they have to trace more upper level to derive the pairwise distance). 
> Another derivation is about intermediate nodes. For example, the distance 
> between subgroup R1441-X29 and end node R1909 is 42.3+ (9+1.3)

I would recommend the book "Pro Perl Parsing", by Christopher M. Frenz,
Apress, and the module Parse::RecDescent (but the latter has a steep
learning curve).

-- 
Jim Gibson


------------------------------

Date: Fri, 30 Sep 2011 11:27:47 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: perl module for context grammar?
Message-Id: <3aehl8x40r.ln2@goaway.wombat.san-francisco.ca.us>

On 2011-09-30, ela <ela@yantai.org> wrote:
> While there is another perl module that deals with the following complex 
> structure,
>
> (((((((R1441:65.00000000,X29:44.66666667):42.33333333,(R1842:3.00000000,R1909:9.00000000):1.33333333):1.33333333,(R1390:13.00000000,R1505:8.00000000):2.33333333):4.00000000,X122:4.66666667):25.33333333,((CCDC5180:23.00000000,HN878:22.00000000):10.00000000,(CCDC5079:28.00000000,(BT1:28.00000000,BT2:36.00000000):1.00000000):20.00000000):0.00000000):1.00000000,BS1:12.00000000):45.00000000,(R1207:9.00000000,(R1746:40.00000000,((X132:0.00000000,X28:0.00000000):6.50000000,(X156:67.83333333,X85:51.83333333):52.33333333):3.50000000):4.00000000):62.00000000,(kzn4207:6.00000000,(kznR506:3.00000000,kznV2475:2.00000000):8.00000000):245.00000000);
>
> the module does not have the function I need.

You don't mention what module you're using.  If that's a Newick format,
have you looked at the Bioperl Bio::Tree modules?

--keith


-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



------------------------------

Date: Sat, 1 Oct 2011 05:22:17 +0800
From: "ela" <ela@yantai.org>
Subject: Re: perl module for context grammar?
Message-Id: <j65but$853$1@ijustice.itsc.cuhk.edu.hk>


"Keith Keller" <kkeller-usenet@wombat.san-francisco.ca.us> wrote in message 
news:3aehl8x40r.ln2@goaway.wombat.san-francisco.ca.us...
> You don't mention what module you're using.  If that's a Newick format,
> have you looked at the Bioperl Bio::Tree modules?

While this module contains functions like "get_lca" to check supergroup, 
there is no further documentation how the distance from this supergroup with 
other nodes can be obtained. Moreover, the data structure is encapsulated 
and so while there is another function called "is_monophyletic", I cannot 
actually trace back hierarchically from the leaf to get more "nearest 
neighbor" nodes but have to exhaust all the nodes and derive the relation 
(or hierarchy) myself. That's why I posted a question here to see if 
standard Perl modules have dealt with this. 




------------------------------

Date: Sat, 1 Oct 2011 05:28:53 +0800
From: "ela" <ela@yantai.org>
Subject: Re: perl module for context grammar?
Message-Id: <j65cb9$875$1@ijustice.itsc.cuhk.edu.hk>


"Jim Gibson" <jimsgibson@gmail.com> wrote in message 
news:300920110932542310%jimsgibson@gmail.com...
> I would recommend the book "Pro Perl Parsing", by Christopher M. Frenz,
> Apress, and the module Parse::RecDescent (but the latter has a steep
> learning curve).

Oh, it's CHAPTER 5 Performing Recursive-Descent Parsing with 
Parse::RecDescent . . . I guess the module actually uses this. Let me read 
that first and thanks for telling me this kind of problem is called 
"recursive decent parsing"! 




------------------------------

Date: Fri, 30 Sep 2011 17:28:26 -0700
From: sln@netherlands.com
Subject: Re: perl module for context grammar?
Message-Id: <r3nc87l65j6a02mcc6dglqlu700a5dtn43@4ax.com>

On Fri, 30 Sep 2011 20:07:28 +0800, "ela" <ela@yantai.org> wrote:

>While there is another perl module that deals with the following complex 
>structure,
>
>(((((((R1441:65.00000000,X29:44.66666667):42.33333333,(R1842:3  ...
>

Formatting the structure goes a long way.
(
     
     (
          
          (
               
               (
                    
                    (
                         
                         (
                              
                              (
                                   R1441 : 65.00000000 ,
                                   X29 : 44.66666667

                              ) : 42.33333333 ,
                              
                              (
                                   R1842 : 3.00000000 ,
                                   R1909 : 9.00000000

                              ) : 1.33333333

                         ) : 1.33333333 ,
                         
                         (
                              R1390 : 13.00000000 ,
                              R1505 : 8.00000000

                         ) : 2.33333333

                    ) : 4.00000000 ,
                    X122 : 4.66666667

               ) : 25.33333333 ,
               
               (
                    
                    (
                         CCDC5180 : 23.00000000 ,
                         HN878 : 22.00000000

                    ) : 10.00000000 ,
                    
                    (
                         CCDC5079 : 28.00000000 ,
                         
                         (
                              BT1 : 28.00000000 ,
                              BT2 : 36.00000000

                         ) : 1.00000000

                    ) : 20.00000000

               ) : 0.00000000

          ) : 1.00000000 ,
          BS1 : 12.00000000

     ) : 45.00000000 ,
     
     (
          R1207 : 9.00000000 ,
          
          (
               R1746 : 40.00000000 ,
               
               (
                    
                    (
                         X132 : 0.00000000 ,
                         X28 : 0.00000000

                    ) : 6.50000000 ,
                    
                    (
                         X156 : 67.83333333 ,
                         X85 : 51.83333333

                    ) : 52.33333333

               ) : 3.50000000

          ) : 4.00000000

     ) : 62.00000000 ,
     
     (
          kzn4207 : 6.00000000 ,
          
          (
               kznR506 : 3.00000000 ,
               kznV2475 : 2.00000000

          ) : 8.00000000

     ) : 245.00000000

)


------------------------------

Date: Wed, 28 Sep 2011 15:14:51 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: question about speed of sequential string replacement vs regex or
Message-Id: <8739fgjuf8.fsf@castleamber.com>

Willem <willem@toad.stack.nl> writes:

> Eli the Bearded wrote:
> ) In comp.lang.perl.misc, Willem  <willem@toad.stack.nl> wrote:
> )> In Perl, it would be applicable.  You see, in Perl, you can call a function
> )> in the replacement of the regex substitution, which can then look up the
> )> html entity and return the wanted unicode literal.
> )
> ) A function? I'd use a hash.
>
> A function can return a sensible value for unknown substitutions.

You can do that also in the RHS of the substitution and still keep it
readable if you use something like

s{..}{

    your
    code
    goes
    here
}ge;

However, a function can be easier on the eye:

s{...}{ some_good_name( ... ) }ge;

-- 
John Bokma                                                               j3b

Blog: http://johnbokma.com/        Perl Consultancy: http://castleamber.com/
Perl for books:    http://johnbokma.com/perl/help-in-exchange-for-books.html


------------------------------

Date: Thu, 29 Sep 2011 06:34:32 -0600
From: robin <r@thevoid1.net>
Subject: so stop problematic
Message-Id: <j61okr$r78$1@speranza.aioe.org>

withchcraft laws and bad thought phones.
-r


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 3509
***************************************


home help back first fref pref prev next nref lref last post