2009/11/23 Dave Tang :
> On Tue, 24 Nov 2009 09:39:09 +1000, Dermot wrote:
>
>> 2009/11/23 Dave Tang :
>>>
>>> On Mon, 23 Nov 2009 23:14:51 +1000, Shawn H Corey
>>>
>>> Hi Shawn et al.,
>>>
>>> I am also intrigued by the \z anchor. I had a look at perldoc perlreref
>>> and
>>> found
>>>
>>> \z M
gaochong wrote:
> But I think substr is better .
>
> my $str="0111";
> my $r=substr ($str,-3);
TimTowTdi (there is more than one way to do it):
my $n = "0111";
my $last_3_chars = join('',(split(//,$n))[-3..-1]);
print "$last_3_chars\n";
--
Just my 0.0002 million do
--- On Tue, 24/11/09, Shawn H Corey wrote:
> From: Shawn H Corey
> Subject: Re: 答复: Regex to get last 3 digits of a number.
> To: "gaochong"
> Cc: "'John W. Krahn'" , "'Perl Beginners'"
>
> Received: Tuesday, 24 November, 2009, 8:26 PM
> gaochong wrote:
> > But I think substr is better .
>
> From: Steve Bertrand [mailto:st...@ibctech.ca]
> Hi everyone,
>
> I'm curious to know if there is an easy way to scan a list of module
> files and identify how many subs are calling a different specific sub.
>
> I've got a method that must be called once by each and every
> sub within
> the
On Tue, 24 Nov 2009 18:33:30 +1000, Dermot wrote:
2009/11/23 Dave Tang :
On Tue, 24 Nov 2009 09:39:09 +1000, Dermot
wrote:
2009/11/23 Dave Tang :
On Mon, 23 Nov 2009 23:14:51 +1000, Shawn H Corey
Hi Shawn et al.,
I am also intrigued by the \z anchor. I had a look at perldoc
perl
Hack, Gabi (ext) wrote:
>> From: Steve Bertrand [mailto:st...@ibctech.ca]
>> Hi everyone,
>>
>> I'm curious to know if there is an easy way to scan a list of module
>> files and identify how many subs are calling a different specific sub.
>>
>> I've got a method that must be called once by each an
Yonghua Peng wrote:
>
> --- On Tue, 24/11/09, Shawn H Corey wrote:
>
>> From: Shawn H Corey
>> Subject: Re: 答复: Regex to get last 3 digits of a number.
>> To: "gaochong"
>> Cc: "'John W. Krahn'" , "'Perl Beginners'"
>>
>> Received: Tuesday, 24 November, 2009, 8:26 PM
>> gaochong wrote:
>>> B
Hi,
The following should work:
my $number = '0111';
my ($index) = ( $number =~ /\d+(\d{3})/ );
$index would contain the last three digits: '111'.
To learn about regular expressions in Perl, you can go through `perldoc
perlre` and `perldoc perlretut`. The Perldoc website
(http://pe
On Nov 23, 9:22 am, jwkr...@shaw.ca (John W. Krahn) wrote:
> shadow52 wrote:
> > Hey everyone,
>
> Hello,
>
> > I am trying to get just the last 3 numbers from the following number
> > from perl using regexs but I have not had no success so I was hoping
> > that I could get a little help on this. I
On Nov 23, 9:22 am, jwkr...@shaw.ca (John W. Krahn) wrote:
> shadow52 wrote:
> > Hey everyone,
>
> Hello,
>
> > I am trying to get just the last 3 numbers from the following number
> > from perl using regexs but I have not had no success so I was hoping
> > that I could get a little help on this. I
On Nov 23, 9:22 am, jwkr...@shaw.ca (John W. Krahn) wrote:
> shadow52 wrote:
> > Hey everyone,
>
> Hello,
>
> > I am trying to get just the last 3 numbers from the following number
> > from perl using regexs but I have not had no success so I was hoping
> > that I could get a little help on this. I
Thank you very much for the great suggestions, I appreciate!
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
On Nov 23, 9:22 am, jwkr...@shaw.ca (John W. Krahn) wrote:
> shadow52 wrote:
> > Hey everyone,
>
> Hello,
>
> > I am trying to get just the last 3 numbers from the following number
> > from perl using regexs but I have not had no success so I was hoping
> > that I could get a little help on this. I
Shawn H Corey wrote:
Yonghua Peng wrote:
--- On Tue, 24/11/09, Shawn H Corey wrote:
From: Shawn H Corey
Subject: Re: ç”å¤�: Regex to get last 3 digits of a number.
To: "gaochong"
Cc: "'John W. Krahn'" , "'Perl Beginners'"
Received: Tuesday, 24 November, 2009, 8:26 PM
gaochong wrote:
But
2009/11/23 Alan Haggai Alavi :
> my $number = '0111';
> my ($index) = ( $number =~ /\d+(\d{3})/ );
>
> $index would contain the last three digits: '111'.
\d+ should be \d* above, otherwise you fail to match on 3 digit numbers:
p...@tui:~/tmp$ perl -E '
my $number = q{111};
my ($index)
2009/11/18 Randal L. Schwartz :
>
> I prefer a pattern that looks more like this:
>
> sub expensive_to_calculate {
>
> my $self = shift;
> my $input = shift; # cache on this scalar
>
> our %cache_for_expensive_to_calculate;
> return $cache_for_expensive_to_calculate{$input} ||= do {
> expens
> "Dermot" == Dermot writes:
Dermot> It' is perl, v5.6.2, on a modperl 1,
...
Dermot> I guess the question is: Will the declaration of our %cache within a
Dermot> function-orientated sub-routine render it always uninitialized?
I believe what you are seeing is that %cache is per-child, so
I have a feeling I am missing something basic so I am looking to this list
for help.
Assume the following:
my $vhost_server_name = qw(somedomain.com);
my @vhost_server_alias_array = qw(www.somedomain.com *.somedomain.com
sub.somedomain.com);
foreach my $vhost_server_alias (@vhost_server_alias_ar
Chad Morland wrote:
> I have a feeling I am missing something basic so I am looking to this list
> for help.
>
> Assume the following:
>
> my $vhost_server_name = qw(somedomain.com);
> my @vhost_server_alias_array = qw(www.somedomain.com *.somedomain.com
> sub.somedomain.com);
>
> foreach my $vh
Thanks Steve, that seemed to do the trick.
Perhaps my reading comprehension was not up to par when I was reading up on
these operators.
I figured AND(&&) operators had to match both conditions in order to be
true, hence me trying to use OR(||). I guess it's the opposite?
-CM
On Tue, Nov 24, 200
Chad Morland wrote:
> Thanks Steve, that seemed to do the trick.
>
> Perhaps my reading comprehension was not up to par when I was reading up on
> these operators.
>
> I figured AND(&&) operators had to match both conditions in order to be
> true, hence me trying to use OR(||). I guess it's the o
On Nov 23, 8:08 am, st...@ibctech.ca (Steve Bertrand) wrote:
> Hi everyone,
>
> I'm curious to know if there is an easy way to scan a list of module
> files and identify how many subs are calling a different specific sub.
>
> I've got a method that must be called once by each and every sub within
>
On Tue, Nov 24, 2009 at 11:12 AM, Chad Morland wrote:
> I figured AND(&&) operators had to match both conditions in order to be
> true, hence me trying to use OR(||). I guess it's the opposite?
>
> On Tue, Nov 24, 2009 at 12:03 PM, Steve Bertrand wrote:
>
> > Chad Morland wrote:
> > > my $vhost_
I've noticed that the POD for several modules do not include method
usage for the functions/methods that are designed as 'internal-only'.
I've reached a stage where not having POD for ALL of my methods is
becoming overwhelmingly cumbersome, as I have to read the code to
remember usage.
Is there a
Steve Bertrand wrote:
> I've noticed that the POD for several modules do not include method
> usage for the functions/methods that are designed as 'internal-only'.
>
> I've reached a stage where not having POD for ALL of my methods is
> becoming overwhelmingly cumbersome, as I have to read the cod
On 11/24/09 Tue Nov 24, 2009 11:09 AM, "Steve Bertrand"
scribbled:
> I've noticed that the POD for several modules do not include method
> usage for the functions/methods that are designed as 'internal-only'.
>
> I've reached a stage where not having POD for ALL of my methods is
> becoming ove
2009/11/24 Steve Bertrand :
> I've noticed that the POD for several modules do not include method
> usage for the functions/methods that are designed as 'internal-only'.
>
> I've reached a stage where not having POD for ALL of my methods is
> becoming overwhelmingly cumbersome, as I have to read th
Hi,
# perl -le '$_="aXXXb"; print "one word is $1" while(/(X*)/g);'
one word is
one word is XXX
one word is
one word is
what are the three empty values in the output?
Thanks.
# perl -v
This is perl, v5.8.8 built for i486-linux-thread-multi
--
To unsubscribe, e-mail: beginners-unsubscr...@per
Orchid Fairy (À¼»¨ÏÉ×Ó) wrote:
Hi,
Hello,
# perl -le '$_="aXXXb"; print "one word is $1" while(/(X*)/g);'
one word is
one word is XXX
one word is
one word is
what are the three empty values in the output?
The pattern X* can match zero characters.
$ perl -le'$_="aXXXb"; print "one word is
Orchid Fairy (兰花仙子) wrote:
> Hi,
>
> # perl -le '$_="aXXXb"; print "one word is $1" while(/(X*)/g);'
> one word is
> one word is XXX
> one word is
> one word is
>
>
> what are the three empty values in the output?
Adding pos() (see `perldoc -f pos`) shows what is happening:
$ perl -le '$_="aXX
On Wed, Nov 25, 2009 at 8:38 AM, Shawn H Corey wrote:
>
> It seems to be picking up an extra empty string after a non-zero length
> match.
>
Thanks John and Shawn.
Yup what let me be confused is that, why there is an additional empty
string there?
--
To unsubscribe, e-mail: beginners-unsubscr.
On 11/24/09 Tue Nov 24, 2009 4:42 PM, "Orchid Fairy (兰花仙子)"
scribbled:
> On Wed, Nov 25, 2009 at 8:38 AM, Shawn H Corey wrote:
>
>>
>> It seems to be picking up an extra empty string after a non-zero length
>> match.
>>
>
> Thanks John and Shawn.
> Yup what let me be confused is that, wh
Jim Gibson wrote:
> On 11/24/09 Tue Nov 24, 2009 4:42 PM, "Orchid Fairy (兰花仙子)"
> scribbled:
>
>> On Wed, Nov 25, 2009 at 8:38 AM, Shawn H Corey wrote:
>>
>>> It seems to be picking up an extra empty string after a non-zero length
>>> match.
>>>
>> Thanks John and Shawn.
>> Yup what let me b
Shawn H Corey wrote:
Also:
$ perl -le '$_="aXXXb"; @captured = $_ =~ m{ (X*) }gmsx;print "captured:
<", join( ">, <",@captured), ">"'
captured: <>, , <>, <>
@captured = $_ =~ m{ (X*) }gmsx;
Is usually written as:
@captured = /X*/g;
John
--
The programmer is fighting against the two most
Shawn H Corey wrote:
Jim Gibson wrote:
On 11/24/09 Tue Nov 24, 2009 4:42 PM, "Orchid Fairy (À¼»¨ÏÉ×Ó)"
scribbled:
On Wed, Nov 25, 2009 at 8:38 AM, Shawn H Corey wrote:
It seems to be picking up an extra empty string after a non-zero length
match.
Thanks John and Shawn.
Yup what let m
On Wed, Nov 25, 2009 at 11:06 AM, John W. Krahn wrote:
>
> $ perl -le '$_="aXXXb"; print "one word is $1 at $-[0] to $+[0]" while
> /(X*)/g;'
> one word is at 0 to 0
> one word is XXX at 1 to 4
> one word is at 4 to 4
> one word is at 5 to 5
>
Thanks that's so smart~
But I'm still confused s
36 matches
Mail list logo