Re: regex optimization

2010-01-06 Thread Dr.Ruud

Jeff Peng wrote:


Can the code (specially the regex) below be optimized to run faster?

#!/usr/bin/perl
for ($i=0; $i1000; $i+=1) {

 open HD,index.html or die $!;
 while(HD) {
   print $1,\n if /href=http:\/\/(.*?)\/.* target=_blank/;
 }
 close HD;
}


Let me first normalize the code.

  #!/usr/bin/perl
  use strict;
  use warnings;

  my $fname = index.html;

  for my $i ( 0 .. 999 ) {

  open my $fh, , $fname or die $!;

  while( $fh ) {
  print $1,\n
if m{href=http://(.*?)/.* target=_blank};
  }
  close $fh;
  }

So it captures hostnames out of href/target strings.
(for example only out of the first one in a line)

I would add a question mark afther the second .*, to minimize 
backtracking. But that changes the meaning.


Further there is no need to open the file 1000 times, see -f seek.

--
Ruud

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: paths that work in windows and linux + Umlaute

2010-01-06 Thread Dr.Ruud

Andreas Moroder wrote:

a clean way in perl to convert all the umlaute to ascii 
standard characters


Text::Unidecode

--
Ruud

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: perl multithreading

2010-01-06 Thread mud_saisem
On Jan 5, 6:29 am, u...@stemsystems.com (Uri Guttman) wrote:
  ms == mud saisem mud_sai...@hotmail.com writes:

   ms I am trying to learn and understand multithreading but I am not sure
   ms why one would choose to use multithreading ?

   ms Could somebody please explain and perhaps provide a example.

 first off, IMO this isn't a good topic for the perl beginners list as
 threading isn't a simple thing.

 but here is a quick response to what you asked. threading is a form of
 what is called multitasking. this is needed when you need to do multiple
 things at the same time but some of them will be waiting on a resource
 (fetching a web page, accessing a database, etc). multitasking means you
 can usually have some work being done in your program or system at all
 times vs waiting around for one task to finish before starting
 another. there are several other ways to multitask including event loops
 and multiple processes. again, these are topics which are more than
 beginner level and should be asked at other places such as perlmonks,
 usenet or other mailing lists.

 uri

 --
 Uri Guttman  --  u...@stemsystems.com    http://www.sysarch.com--
 -  Perl Code Review , Architecture, Development, Training, Support --
 -  Gourmet Hot Cocoa Mix    http://bestfriendscocoa.com-

That is a perfect response thanks.

I will take any other questions to the suggested places.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Please remove all references in mail archive

2010-01-06 Thread jay taylor
Hello,
I am reggie kogulan. 
 
Please remove all references in beginners.perl.org. 
Back in 2003, I was subscribing to this list and I stopped it. 
I did post many messages. I want them to be removed. Because, 
I did not have idea, you will be posting everything on the internet. 
Google is able to find me. 
 
Please remove every link to my name in the mail-archive.com as soon as possible 
otherwise, I would have to take legal actions. 
 
www.mail-archive.com/beginners@perl.org/msg44490.html 


  

Re: Please remove all references in mail archive

2010-01-06 Thread jm
thought
if this person really believes he has any expectation of privacy regarding
any aspect of the internet, then i have some prime swampland in the sahara
i'd love to sell him
end thought

good luck with that


On Tue, Jan 5, 2010 at 11:16 PM, jay taylor jaytay2...@yahoo.com wrote:

 Hello,
 I am reggie kogulan.

 Please remove all references in beginners.perl.org.
 Back in 2003, I was subscribing to this list and I stopped it.
 I did post many messages. I want them to be removed. Because,
 I did not have idea, you will be posting everything on the internet.
 Google is able to find me.

 Please remove every link to my name in the mail-archive.com as soon as
 possible otherwise, I would have to take legal actions.

 www.mail-archive.com/beginners@perl.org/msg44490.html







-- 
since this is a gmail account, please verify the mailing list is included in
the reply to addresses


Re: Please remove all references in mail archive

2010-01-06 Thread Shawn H Corey
jm wrote:
 thought
 if this person really believes he has any expectation of privacy regarding
 any aspect of the internet, then i have some prime swampland in the sahara
 i'd love to sell him
 end thought
 
 good luck with that

Please don't feed the trolls.


-- 
Just my 0.0002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




double quotes are needed

2010-01-06 Thread Grove, Michael
Can someone tell me why I need double quotes for this to work at the line with: 
print $first, $second, $third\n;

#!/usr/bin/perl -w

$first = 0xFF;
$second = 0377;
$third = 0b;
print $first, $second, $third\n;
$answer = $first + $second + $third;
print $answer\n;

It only gives this output when I write double quotes print $first, $second, 
$third\n;

255, 255, 255
765


Mike Grove | AIX System Administrator
OIT - BIO - Server Farms Division
PA Department of Labor  Industry
651 Boas Street Room 124 | Harrisburg, PA 17121
Phone: 717-705-2724 | Fax: 717-783-6364
AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502








Re: double quotes are needed

2010-01-06 Thread Shlomi Fish
Hi Mike!

On Wednesday 06 Jan 2010 19:27:59 Grove, Michael wrote:
 Can someone tell me why I need double quotes for this to work at the line
  with: print $first, $second, $third\n;
 
 #!/usr/bin/perl -w
 

Don't use -w. Add use strict; and use warnings;. Then fix the errors.


 $first = 0xFF;
 $second = 0377;
 $third = 0b;
 print $first, $second, $third\n;

$third\n is invalid code. The \n must be placed inside a string.

Regards,

Shlomi Fish

 $answer = $first + $second + $third;
 print $answer\n;
 
 It only gives this output when I write double quotes print $first,
  $second, $third\n;
 
 255, 255, 255
 765
 
 
 Mike Grove | AIX System Administrator
 OIT - BIO - Server Farms Division
 PA Department of Labor  Industry
 651 Boas Street Room 124 | Harrisburg, PA 17121
 Phone: 717-705-2724 | Fax: 717-783-6364
 AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502
 

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Interview with Ben Collins-Sussman - http://shlom.in/sussman

Bzr is slower than Subversion in combination with Sourceforge. 
( By: http://dazjorz.com/ )

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: double quotes are needed

2010-01-06 Thread Robert Wohlfarth
On Wed, Jan 6, 2010 at 11:27 AM, Grove, Michael migr...@state.pa.us wrote:

 Can someone tell me why I need double quotes for this to work at the line
 with: print $first, $second, $third\n;

 #!/usr/bin/perl -w

 $first = 0xFF;
 $second = 0377;
 $third = 0b;
 print $first, $second, $third\n;


This passes a list to the print command. It's equivalent to saying...
my @list = ($first, $second, $third);
print @list;

$answer = $first + $second + $third;
 print $answer\n;

 It only gives this output when I write double quotes print $first,
 $second, $third\n;

 255, 255, 255
 765


print $first, $second, $third\n prints a single, scalar value.

-- 
Robert Wohlfarth


Re: double quotes are needed

2010-01-06 Thread Jim Gibson
On 1/6/10 Wed  Jan 6, 2010  9:27 AM, Grove, Michael migr...@state.pa.us
scribbled:

 Can someone tell me why I need double quotes for this to work at the line
 with: print $first, $second, $third\n;
 
 #!/usr/bin/perl -w
 
 $first = 0xFF;
 $second = 0377;
 $third = 0b;
 print $first, $second, $third\n;
 $answer = $first + $second + $third;
 print $answer\n;
 
 It only gives this output when I write double quotes print $first, $second,
 $third\n;
 
 255, 255, 255
 765

What output do you get when you do not write double quotes? I get 'Backslash
found where operator expected at ...'. Is that what you get? (It helps to
let us know what you are getting from your original version).

The print function prints strings. The unquoted \n is not a string - it is a
syntax error. If the \n is enclosed in double quotes, it will generate a
newline character.

Did you really mean print $first, $second, $third\n
or did you mean print $first, $second, $third\n ?
The former is a standalone string and does nothing. The latter will print
the results as you have shown.

You should put 'use strict;' at the top of your program, and remove the '-w'
and replace it with 'use warnings;'.



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: double quotes are needed

2010-01-06 Thread Grove, Michael
Thanks.

Is this better?

print $first, $second, $third,\n;

255, 255, 255
765

If I put the second set of quotes after the last comma, I get an error.

I am only on pg 21 of Learning Perl 5th ed. I am trying as many variations of 
the examples just to mess around and see what happens with different characters.


Mike Grove | AIX System Administrator
OIT - BIO - Server Farms Division
PA Department of Labor  Industry
651 Boas Street Room 124 | Harrisburg, PA 17121
Phone: 717-705-2724 | Fax: 717-783-6364
AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502





-Original Message-
From: Shlomi Fish [mailto:shlo...@iglu.org.il]
Sent: Wednesday, January 06, 2010 12:45 PM
To: beginners@perl.org
Cc: Grove, Michael
Subject: Re: double quotes are needed

Hi Mike!

On Wednesday 06 Jan 2010 19:27:59 Grove, Michael wrote:
 Can someone tell me why I need double quotes for this to work at the line
  with: print $first, $second, $third\n;

 #!/usr/bin/perl -w


Don't use -w. Add use strict; and use warnings;. Then fix the errors.


 $first = 0xFF;
 $second = 0377;
 $third = 0b;
 print $first, $second, $third\n;

$third\n is invalid code. The \n must be placed inside a string.

Regards,

Shlomi Fish

 $answer = $first + $second + $third;
 print $answer\n;

 It only gives this output when I write double quotes print $first,
  $second, $third\n;

 255, 255, 255
 765


 Mike Grove | AIX System Administrator
 OIT - BIO - Server Farms Division
 PA Department of Labor  Industry
 651 Boas Street Room 124 | Harrisburg, PA 17121
 Phone: 717-705-2724 | Fax: 717-783-6364
 AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502


--
-
Shlomi Fish   http://www.shlomifish.org/
Interview with Ben Collins-Sussman - http://shlom.in/sussman

Bzr is slower than Subversion in combination with Sourceforge.
( By: http://dazjorz.com/ )

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: double quotes are needed

2010-01-06 Thread Shlomi Fish
On Wednesday 06 Jan 2010 20:38:29 Grove, Michael wrote:
 Thanks.
 
 Is this better?
 
 print $first, $second, $third,\n;
 

Yes, but you can also write it as:


print $first, $second, $third\n;


 255, 255, 255
 765
 
 If I put the second set of quotes after the last comma, I get an error.
 

What do you mean by that? How are you writing it?

Also, please avoid top-posting and quote my reply:

http://en.wikipedia.org/wiki/Posting_style

Regards,

Shlomi Fish

 I am only on pg 21 of Learning Perl 5th ed. I am trying as many variations
  of the examples just to mess around and see what happens with different
  characters.
 
 
 Mike Grove | AIX System Administrator
 OIT - BIO - Server Farms Division
 PA Department of Labor  Industry
 651 Boas Street Room 124 | Harrisburg, PA 17121
 Phone: 717-705-2724 | Fax: 717-783-6364
 AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Optimising Code for Speed - http://shlom.in/optimise

Bzr is slower than Subversion in combination with Sourceforge. 
( By: http://dazjorz.com/ )

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: double quotes are needed

2010-01-06 Thread Jim Gibson
On 1/6/10 Wed  Jan 6, 2010  10:38 AM, Grove, Michael migr...@state.pa.us
scribbled:

 Thanks.
 
 Is this better?
 
 print $first, $second, $third,\n;

I would just use:

print $first, $second, $third\n;

 
 255, 255, 255
 765
 
 If I put the second set of quotes after the last comma, I get an error.

Not sure what you mean. Can you show us the exact line and the exact error
you are getting?




-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: double quotes are needed

2010-01-06 Thread Grove, Michael
Thanks everyone.

The one line I wrote was a mistake in quote placement for this message:
print $first, $second, $third\n

meant

print $first, $second, $third, \n

But I don't want the last comma in the output, so I wrote this with your help:

#!/usr/bin/perl

$first = 0xFF;
$second = 0377;
$third = 0b;
print $first, $second, $third,\n;
$answer = $first + $second + $third;
print $answer\n;

or is this way preferred?

#!/usr/bin/perl

$first = 0xFF;
$second = 0377;
$third = 0b;
print $first, $second, $third\n;
$answer = $first + $second + $third;
print $answer\n;




Mike Grove | AIX System Administrator
OIT - BIO - Server Farms Division
PA Department of Labor  Industry
651 Boas Street Room 124 | Harrisburg, PA 17121
Phone: 717-705-2724 | Fax: 717-783-6364
AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502





-Original Message-
From: Shlomi Fish [mailto:shlo...@iglu.org.il]
Sent: Wednesday, January 06, 2010 1:48 PM
To: beginners@perl.org
Cc: Grove, Michael
Subject: Re: double quotes are needed

On Wednesday 06 Jan 2010 20:38:29 Grove, Michael wrote:
 Thanks.

 Is this better?

 print $first, $second, $third,\n;


Yes, but you can also write it as:


print $first, $second, $third\n;


 255, 255, 255
 765

 If I put the second set of quotes after the last comma, I get an error.


What do you mean by that? How are you writing it?

Also, please avoid top-posting and quote my reply:

http://en.wikipedia.org/wiki/Posting_style

Regards,

Shlomi Fish

 I am only on pg 21 of Learning Perl 5th ed. I am trying as many variations
  of the examples just to mess around and see what happens with different
  characters.


 Mike Grove | AIX System Administrator
 OIT - BIO - Server Farms Division
 PA Department of Labor  Industry
 651 Boas Street Room 124 | Harrisburg, PA 17121
 Phone: 717-705-2724 | Fax: 717-783-6364
 AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502

--
-
Shlomi Fish   http://www.shlomifish.org/
Optimising Code for Speed - http://shlom.in/optimise

Bzr is slower than Subversion in combination with Sourceforge.
( By: http://dazjorz.com/ )

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: double quotes are needed

2010-01-06 Thread Grove, Michael
Shlomi, what is top posting? where you said: please avoid top-posting and 
quote my reply

Fyi I used use strict; and use warnings;
And got a bunch of global errors to I put my in front of all of my variables. 
I have a lot to learn still.


#!/usr/bin/perl

use strict;
use warnings;

my $first = 0xFF;
my $second = 0377;
my $third = 0b;
print $first, $second, $third\n;
my $answer = $first + $second + $third;
print $answer\n;

Mike Grove | AIX System Administrator
OIT - BIO - Server Farms Division
PA Department of Labor  Industry
651 Boas Street Room 124 | Harrisburg, PA 17121
Phone: 717-705-2724 | Fax: 717-783-6364
AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502





-Original Message-
From: Shlomi Fish [mailto:shlo...@iglu.org.il]
Sent: Wednesday, January 06, 2010 1:48 PM
To: beginners@perl.org
Cc: Grove, Michael
Subject: Re: double quotes are needed

On Wednesday 06 Jan 2010 20:38:29 Grove, Michael wrote:
 Thanks.

 Is this better?

 print $first, $second, $third,\n;


Yes, but you can also write it as:


print $first, $second, $third\n;


 255, 255, 255
 765

 If I put the second set of quotes after the last comma, I get an error.


What do you mean by that? How are you writing it?

Also, please avoid top-posting and quote my reply:

http://en.wikipedia.org/wiki/Posting_style

Regards,

Shlomi Fish

 I am only on pg 21 of Learning Perl 5th ed. I am trying as many variations
  of the examples just to mess around and see what happens with different
  characters.


 Mike Grove | AIX System Administrator
 OIT - BIO - Server Farms Division
 PA Department of Labor  Industry
 651 Boas Street Room 124 | Harrisburg, PA 17121
 Phone: 717-705-2724 | Fax: 717-783-6364
 AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502

--
-
Shlomi Fish   http://www.shlomifish.org/
Optimising Code for Speed - http://shlom.in/optimise

Bzr is slower than Subversion in combination with Sourceforge.
( By: http://dazjorz.com/ )

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: double quotes are needed

2010-01-06 Thread Grove, Michael
Ok, this is my final draft.

Though it is syntactically correct, is it a good way to assign variables?

#!/usr/bin/perl

use strict;
use warnings;

my $first = 0xFF;
my $second = 0377;
my $third = 0b;
my $answer = $first + $second + $third;

print $first, $second, $third\n;
print $answer\n;

Mike Grove | AIX System Administrator
OIT - BIO - Server Farms Division
PA Department of Labor  Industry
651 Boas Street Room 124 | Harrisburg, PA 17121
Phone: 717-705-2724 | Fax: 717-783-6364
AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502





-Original Message-
From: Shlomi Fish [mailto:shlo...@iglu.org.il]
Sent: Wednesday, January 06, 2010 1:48 PM
To: beginners@perl.org
Cc: Grove, Michael
Subject: Re: double quotes are needed

On Wednesday 06 Jan 2010 20:38:29 Grove, Michael wrote:
 Thanks.

 Is this better?

 print $first, $second, $third,\n;


Yes, but you can also write it as:


print $first, $second, $third\n;


 255, 255, 255
 765

 If I put the second set of quotes after the last comma, I get an error.


What do you mean by that? How are you writing it?

Also, please avoid top-posting and quote my reply:

http://en.wikipedia.org/wiki/Posting_style

Regards,

Shlomi Fish

 I am only on pg 21 of Learning Perl 5th ed. I am trying as many variations
  of the examples just to mess around and see what happens with different
  characters.


 Mike Grove | AIX System Administrator
 OIT - BIO - Server Farms Division
 PA Department of Labor  Industry
 651 Boas Street Room 124 | Harrisburg, PA 17121
 Phone: 717-705-2724 | Fax: 717-783-6364
 AIX Hot Line 717-525-5598 | AIX Cell 717-329-0502

--
-
Shlomi Fish   http://www.shlomifish.org/
Optimising Code for Speed - http://shlom.in/optimise

Bzr is slower than Subversion in combination with Sourceforge.
( By: http://dazjorz.com/ )

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: double quotes are needed

2010-01-06 Thread Shlomi Fish
Hi!

On Wednesday 06 Jan 2010 21:10:16 Grove, Michael wrote:
 Shlomi, what is top posting? where you said: please avoid top-posting
  and quote my reply

Please see: http://en.wikipedia.org/wiki/Posting_style . I gave you that link 
in my reply.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Parody on The Fountainhead - http://shlom.in/towtf

Bzr is slower than Subversion in combination with Sourceforge. 
( By: http://dazjorz.com/ )

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: regex optimization

2010-01-06 Thread Brad Baxter

Dr.Ruud wrote:

Jeff Peng wrote:


Can the code (specially the regex) below be optimized to run faster?

#!/usr/bin/perl
for ($i=0; $i1000; $i+=1) {

 open HD,index.html or die $!;
 while(HD) {
   print $1,\n if /href=http:\/\/(.*?)\/.* target=_blank/;
 }
 close HD;
}


Let me first normalize the code.

  #!/usr/bin/perl
  use strict;
  use warnings;

  my $fname = index.html;

  for my $i ( 0 .. 999 ) {

  open my $fh, , $fname or die $!;

  while( $fh ) {
  print $1,\n
if m{href=http://(.*?)/.* target=_blank};
  }
  close $fh;
  }

So it captures hostnames out of href/target strings.
(for example only out of the first one in a line)

I would add a question mark afther the second .*, to minimize 
backtracking. But that changes the meaning.


Further there is no need to open the file 1000 times, see -f seek.



And for the sake of argument, the regex at best makes
assumptions about what's in index.html, at worst, it
gives incorrect results, e.g., from the following:

html
a href=http://www.amazon.com/;Amazon/a a 
href=http://www.google.com/; target=_blankGoogle/a

/html

I would assume from the regex that google's address
is the one the user wants, but amazon's is what he
will get.

Before going to the trouble of optimizing for speed,
I think it would be best to optimize for correctness
first.  :-)

--
Brad

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: paths that work in windows and linux + Umlaute

2010-01-06 Thread Andreas Moroder

  JWK 5) It is Perl4 code from 8 years ago.

that code is an abomination. one quick bug is the GetDir recursive
descent sub to get all dirs doesn't check for symlinks so it can easily
fall into an infinite recursion. the abuse of undef() is beyond bad nor
needed. and as john said, it is perl4 code which means it is about 15
years old. it should never be installed or used anywhere. also it says
it is for winblows activestate perl so it would never be easily ported
to unix as it assumes \ everywhere for dir separators. also most/all of it
is available in portable modules on cpan. it seems to more interested in
integrating into some winblows gui toy than doing real work.

so if you want to learn good perl code, look at that and see what really
BAD perl code is like. especially bad perl4 code.

uri


Hello,

I did not ask because I want to learn perl, but because I need the 
functionality of this application. I did not find anything else that 
does a similar job.


Bye and thank you
Andreas


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: paths that work in windows and linux + Umlaute

2010-01-06 Thread Uri Guttman
 AM == Andreas Moroder andreas.moro...@sb-brixen.it writes:

  JWK 5) It is Perl4 code from 8 years ago.
   
   that code is an abomination. one quick bug is the GetDir recursive
   descent sub to get all dirs doesn't check for symlinks so it can easily
   fall into an infinite recursion. the abuse of undef() is beyond bad nor
   needed. and as john said, it is perl4 code which means it is about 15
   years old. it should never be installed or used anywhere. also it says
   it is for winblows activestate perl so it would never be easily ported
   to unix as it assumes \ everywhere for dir separators. also most/all of it
   is available in portable modules on cpan. it seems to more interested in
   integrating into some winblows gui toy than doing real work.
   
   so if you want to learn good perl code, look at that and see what really
   BAD perl code is like. especially bad perl4 code.

  AM I did not ask because I want to learn perl, but because I need the
  AM functionality of this application. I did not find anything else that
  AM does a similar job.

then why did you ask here, on a list aimed at teaching perl to
beginners? this is not the place to ask for help on how to fix horrible
old perl4 code. and you don't seem to get it, that code is nasty and
bugridden. you haven't even tried to write your own modern code for
it. most of it (from my painful but fast scan) can be done with a few
common cpan modules.

uri

-- 
Uri Guttman  --  u...@stemsystems.com    http://www.sysarch.com --
-  Perl Code Review , Architecture, Development, Training, Support --
-  Gourmet Hot Cocoa Mix    http://bestfriendscocoa.com -

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: regex optimization

2010-01-06 Thread C.DeRykus
On Jan 5, 12:13 am, moonb...@gmail.com (Erez Schatz) wrote:
 2010/1/5 Jeff Peng jeffp...@netzero.net:

 ...
 This is something that Perl  (post version 5.6) does inherently, which
 is compiling a regex only once as long as the pattern isn't modified.
 Prior to 5.6 you'd need to use the /o modifier (
 m/href=http:\/\/(.*?)\/.* target=_blank/o ).


Um no.  The /o modifer stops re-compilation only if the regex
needs to interpolate a variable. Otherwise, /o has no effect.
Perl, has always AFAIK, cached regex compilations for re-use
if there aren't variable interpolations since then the regex
can't possibly change.

--
Charles DeRykus





--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: paths that work in windows and linux + Umlaute

2010-01-06 Thread Andreas Moroder

  AM I did not ask because I want to learn perl, but because I need the
  AM functionality of this application. I did not find anything else that
  AM does a similar job.

then why did you ask here, on a list aimed at teaching perl to
beginners? this is not the place to ask for help on how to fix horrible
old perl4 code. and you don't seem to get it, that code is nasty and
bugridden. you haven't even tried to write your own modern code for
it. most of it (from my painful but fast scan) can be done with a few
common cpan modules.

uri


Hello,

my answer was not clear.
Sure I want to lern pearl, ( I already wrote a few small scripts ).
I did not understand that the code is so bad so I tried to clean it up a 
little bit to get the work done.
Now you say that this could be done with a few cpan modules. Here my 
begginers question: could you please tell me what are the right modules 
to use ?


Sorry and thank you
Andreas


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/