On Tue, 25 Jan 2005 14:39:42 -0500, renard <[EMAIL PROTECTED]> wrote:
> I am a newbie and have been following this thread since I am interested in
> benchmarking.
>
> So I copied the code and ran it on my machine. I have a 3.5 MHz system
> runing Windows XP. I am using ActivePerl 3.8.6.
>
> On my
I am a newbie and have been following this thread since I am interested in
benchmarking.
So I copied the code and ran it on my machine. I have a 3.5 MHz system
runing Windows XP. I am using ActivePerl 3.8.6.
On my machine, benchmark complained about too few iterations. So I modified
the script in t
On Mon, 24 Jan 2005 10:46:38 -0500, Dave Gray <[EMAIL PROTECTED]> wrote:
> > 'plain_regex'=> sub { if ( $string =~ /^.{38}\|[BNPG]\|/ ) {
> > my $a = $_ } },
> > 'plain_regex'=> sub { if ( $string =~ /^.{38}\|N\|/ ) { my $a = $_
> > } },
> >
> > What was interesting to me was that
Perl Beginners
Subject: Re: How to find regex at specific location on line
Graeme St. Clair wrote:
> Try the {} notation, that says how many whats are required before the
> which (as it were). Perhaps something like:-
>
> if (/.{31,33}\|[BNPG]\|/){
> return 2;
>
Thanks to everyone that answered this question.
I ended up using (/^.{30}\|[BNPG]\|/). I plan
on adding some more checks for "|" at specific
locations (other than just ^ and $, which
I have now) for sanity's sake.
Thanks again.
Would it be helpful to others if I were to post the
complete script
> 'plain_regex'=> sub { if ( $string =~ /^.{38}\|[BNPG]\|/ ) {
> my $a = $_ } },
> 'plain_regex'=> sub { if ( $string =~ /^.{38}\|N\|/ ) { my $a = $_ }
> },
>
> What was interesting to me was that although, predictably, the
> substring/regex combo was consistently the best perform
On Sat, 22 Jan 2005 13:34:54 -0800, John W. Krahn <[EMAIL PROTECTED]> wrote:
>
> Yes, two ways that I can think of:
>
> if ( substr( $_, 30, 3 ) =~ /\|[BNPG]\|/ ) {
>
> if ( /^.{30}\|[BNPG]\|/ ) {
>
> John
> --
For the sake of comparison, here is a set of benckmarks for a c
Graeme St. Clair wrote:
Try the {} notation, that says how many whats are required before the which
(as it were). Perhaps something like:-
if (/.{31,33}\|[BNPG]\|/){
return 2;
}
Meaning, between 31 & 33 characters. Untested!
No, that is not what it means. It means match
ilto:[EMAIL PROTECTED]
Sent: Friday, January 21, 2005 9:24 PM
To: 'Perl Beginners List'
Subject: How to find regex at specific location on line
Hello,
If you would, please consider the following input file:
|6643|Jason Balicki | |0501211243|000:00:00|
Jason Balicki wrote:
Hello,
Hello,
If you would, please consider the following input file:
|6643|Jason Balicki | |0501211243|000:00:00|0| S
|0|
||13145551212 |N|| 0|001001|001001| 100|
10|B|A|
And the following code:
while(<>){
if (whi
Hello,
If you would, please consider the following input file:
|6643|Jason Balicki | |0501211243|000:00:00|0| S
|0|
||13145551212 |N|| 0|001001|001001| 100|
10|B|A|
And the following code:
while(<>){
if (whichline($_) == 1){
11 matches
Mail list logo