Re: PAR fails on AS build 817

2006-04-07 Thread Randy Kobes

On Fri, 7 Apr 2006, Glenn Linderman wrote:

Seems like AS build 817 must have a compatibility problem with PAR.  I can't 
get PAR 0.92 (the latest) or PAR 0.85 (the oldest I had on hand) to build on 
AS build 817.  The previous version of Perl I'd used was  AS 810, both of 
those versions of PAR work there.


Further, the PAR PPM from ActiveState also fails to function properly, 
although it does install.


Using the fix that Rob and Jan explain in other replies, I
put up a ppm package of PAR-0.92 in our
   http://theoryx5.uwinnipeg.ca/ppms/
repository - the package is called PAR-588, and it was
built on ActivePerl 817. This probably won't work
on earlier ActivePerl versions - for these, the PAR
package should be used.

--
best regards,
Randy Kobes
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: PAR fails on AS build 817

2006-04-07 Thread Jan Dubois
On Fri, 07 Apr 2006, Glenn Linderman wrote:
> Seems like AS build 817 must have a compatibility problem with PAR. I
> can't get PAR 0.92 (the latest) or PAR 0.85 (the oldest I had on hand)
> to build on AS build 817. The previous version of Perl I'd used was AS
> 810, both of those versions of PAR work there.

AFAIK this is a bug in Module::Install that has been fixed in version 0.61.

http://rt.cpan.org/Public/Bug/Display.html?id=18181

As you can see this has been reported (and fixed) by ActiveState a week
before 817 was release.

For PAR I provided a workaround here:

http://www.nntp.perl.org/group/perl.par/2312

and it is my understanding that with this fix Rob has been successful in
building that latest release of PAR.  All the other messages in that
thread seem to involve big and unnecessary changes that have complicated
matters,

Anyways, I'm not aware of any incompatibilities of AP817 beyond the
problem with Module::Install that really is a bug in Module::Install
and not in ActivePerl.  It is just that this bug had not been triggered
by previous releases of ActivePerl.

So you can either:

* Fix the PAR distribution by removing a single line from the bundled
  Module::Install.

* Go back to an older ActivePerl

* Wait until a version of PAR with a fixed Module::Install has been released.

Cheers,
-Jan



___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: PAR fails on AS build 817

2006-04-07 Thread Sisyphus

- Original Message - 
From: "Glenn Linderman"
.
.
>  Rob (Sisyphus) was apparently eventually able to
> build PAR on his home-built Perl after some patches, but not (if I
> understand correctly) on AS 817.

You've misunderstood me a little there (which is not surprising given the
length of that thread, and the twists and turns that it takes :-)

I can build PAR-0.92 straight out of the box on my home-built Perls 5.8.8
(both MinGW-built perl and VC++7-built perl).

To build PAR-0.92 on AS 817 (using VC++6.0), I had to remove one line of
code from inc/Module/Install.pm (in the PAR-0.92 source). That "one line of
code" to be removed is:

local @INC = ($path, @INC);

The fact that PAR-0.92 then builds fine for me on build 817 makes it all the
harder to work out why it's not building for Glenn (when he makes the same
change).

Cheers,
Rob

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Replace Leading Spaces (fwd)

2006-04-07 Thread $Bill Luebkert
Glenn Linderman wrote:

> On approximately 4/7/2006 12:11 PM, came the following characters from 
> the keyboard of Nelson R. Pardee:
> 
>>I've included timings for 1 iterations for each of the proposed
>>solutions.
>>
>>0.056398  s/\s(?=\s*\S)/0/og
>>0.254457  while (s/\s(?=(\d|\.))/0/ {)
>>0.094268 s/^(\s+)(?=\d)/'0'x(length $1)/e
>>0.026934 (see below) Strip front space, take length diff, replace with n x "0"
>>0.095046 s/^(\s+)/sprintf "%s", q[0]x length($1)/eg
>>0.086842 s/ (?=.*\d)/0/g
>>
>>Surprisingly, the more manual process is the fastest. This latest positive
>>lookahead is a bit slower than the first one, I'm not sure why.
> 
> 
> I'm not sure either, nor of your measurement technique, but I do notice 
> that the top lookahead uses flags /og and the bottom one only uses /g. 
> Maybe that contributes to the difference in timing?

Shouldn't matter if no $vars involved.

 Rate  RE2  RE5  RE3  RE4  RE1 RE1a
RE2  136761/s   -- -58% -61% -64% -74% -74%
RE5  326584/s 139%   --  -6% -14% -37% -37%
RE3  347705/s 154%   6%   --  -9% -33% -33%
RE4  381098/s 179%  17%  10%   -- -26% -26%
RE1  516529/s 278%  58%  49%  36%   --  -0%
RE1a 516529/s 278%  58%  49%  36%   0%   --

1  $str =~ s/\s(?=\s*\S)/0/og;
1a $str =~ s/\s(?=\s*\S)/0/g;
2  1 while ($str =~ s/\s(?=(\d|\.))/0/);
3  $str =~ s/^(\s+)(?=\d)/'0' x (length $1)/e;
4  $str =~ s/^(\s+)/sprintf "%s", q[0]x length($1)/eg;
5  $str =~ s/ (?=.*\d)/0/g;

Each RE was preceded with re-initing the string.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Peter Eisengrein
> 
> Nelson,
> 
> Please add Mark Thomas' solution to your timings to see how 
> it compares
> to the others:
> 


I'd be curious to see how Wags' sprintf compares as well:

s/^(\s+)/sprintf "%s", q[0]x length($1)/eg;
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Replace Leading Spaces (fwd)

2006-04-07 Thread Nelson R. Pardee

On Fri, 7 Apr 2006, Glenn Linderman wrote:

> On approximately 4/7/2006 12:11 PM, came the following characters from
> the keyboard of Nelson R. Pardee:
> > I've included timings for 1 iterations for each of the proposed
> > solutions.
> >
> > 0.056398  s/\s(?=\s*\S)/0/og
> > 0.254457  while (s/\s(?=(\d|\.))/0/ {)
> > 0.094268 s/^(\s+)(?=\d)/'0'x(length $1)/e
> > 0.026934 (see below) Strip front space, take length diff, replace with n x 
> > "0"
> > 0.095046 s/^(\s+)/sprintf "%s", q[0]x length($1)/eg
> > 0.086842 s/ (?=.*\d)/0/g
> >
> > Surprisingly, the more manual process is the fastest. This latest positive
> > lookahead is a bit slower than the first one, I'm not sure why.
>
> I'm not sure either, nor of your measurement technique, but I do notice
> that the top lookahead uses flags /og and the bottom one only uses /g.
> Maybe that contributes to the difference in timing?

I checked /o- for this regex it doesn't make much difference, although it
can indeed make a difference.

Here's the code snippet for timing- I replace the interior of the for loop
for each variation. prd uses Time::Hires gettimeofday to track time used.
The prd arguments are just stuff to print out.

$_=$val="259.00  ";
$c=1;
&prd(__LINE__." 1");
for $i(0..$c){
   $_=$val;
   s/\s(?=\s*\S)/0/g;
}
print "$_ ";
&prd(__LINE__.' s/\s(?=\s*\S)/0/og');


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Nelson R. Pardee
May not have hit your inbox yet...

0.056398  s/\s(?=\s*\S)/0/og
0.254457  while (s/\s(?=(\d|\.))/0/ {)
0.094268 s/^(\s+)(?=\d)/'0'x(length $1)/e
0.026934 (see below) Strip front space, take length diff, replace with n x
"0"
0.095046 s/^(\s+)/sprintf "%s", q[0]x length($1)/eg
0.086842 s/ (?=.*\d)/0/g

Surprisingly, the more manual process is the fastest. This latest positive
lookahead is a bit slower than the first one, I'm not sure why.

--
($trimmed_string = $_) =~ s/^ *//; # remove leading spaces
$transformed_string = ('0' x ((length $_) - length
$trimmed_string)) . $trimmed_string;
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Replace Leading Spaces

2006-04-07 Thread Lyle Kopnicky

Ken Kriesel wrote:

Why not the more concise

$string =~ s/^(\s+)/'0'x(length $1)/e; 
  
Thanks, that is exactly the same as Paul's solution.  Minus the spaces 
around the 'x'.


--
Lyle Kopnicky
Software Project Engineer
Veicon Technology, Inc.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Perl-Win32-Users Digest, Vol 27, Issue 6 [Possible SPAM]

2006-04-07 Thread Steven Pennie
Title: Secure Message Delivery







  

  



  

  Secure Message Delivery

  
  

	
  	   
  	  


	
	  
  	
		
			  
			
To ensure your privacy, we are securely delivering this email message to you. Blue Cross of Idaho Health Service, Inc., is committed to protecting the privacy of our members' personal information. We adhere to strict standards of security and confidentiality with regard to personal information.
			
			  
			  
			
This message will be available for VIEWING ONLY for a period of 60 days. If you want the message available after that time, please print it or cut and paste it into a word document.
			
			  
			  
			
To view this message and to reply securely, please click the View Message box below.
			
			  
  		  
		

  

FROM:
Steven Pennie

  
			  	  
				
SUBJECT: 
RE: Perl-Win32-Users Digest, Vol 27, Issue 6   [Possible SPAM]
		   		
			  	  

  		
		  
  	  
	 
  	  
  	  
	
	
  	  
	
 VIEW MESSAGE 
	
  	  
	
	
  	  
  	  
	 
  	  
  

   If you are unable to access this message by clicking on the box labeled "View Message," please copy and paste the link below into the Internet Explorer Address Bar.
   
   https://securemail.bcidaho.com/messenger/msg?x=d-286079-ZNA0tHaL

  
  	  
	 
  	  
  		
	
		  
		


	  
  	   
	

  





___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Ken Kriesel
Why not the more concise

$string =~ s/^(\s+)/'0'x(length $1)/e; 

as in

my $string = ' 259.00 ';
print "<$string>\n";
#$string =~ s/^(\s+)(?=\d)/'0'x(length $1)/e; 
$string =~ s/^(\s+)/'0'x(length $1)/e; 
print "<$string>\n";

which outputs:

< 259.00 >
<0259.00 >

showing same spacing fore & aft. ^\s+ alone will match any leading 
white-space, up to where a non-white-space character \S is encountered.

Characters that can have more than one cell width, like \t, could require
special handling if present.


Ken



At 10:56 AM 4/7/2006, Paul Sobey wrote:

>> My $string = ' 259.00 ';
>> 
>> Note that I don't want to change the trailing space character. The
>> resulting string would look like:
>> 
>> '0259.00 '
>> 
>> The total length of the string would remain the same after the replace
>> operation.
>> 
>> I'm just having a total brain-fade on this one.
>
>$string =~ s/^(\s+)/'0' x length($1)/e
>
>Does that do what you want?
>
>P.
>
>*
>Gloucester Research Limited believes the information 
>provided herein is reliable. While every care has been 
>taken to ensure accuracy, the information is furnished 
>to the recipients with no warranty as to the completeness 
>and accuracy of its contents and on condition that any 
>errors or omissions shall not be made the basis for any 
>claim, demand or cause for action.
>
>The information in this email is intended only for the 
>named recipient.  If you are not the intended recipient
>please notify us immediately and do not copy, distribute 
>or take action based on this e-mail.
>
>Gloucester Research Limited, 5th Floor, Whittington House, 
>19-30 Alfred Place, London WC1E 7EA
>*
>
>___
>Perl-Win32-Users mailing list
>Perl-Win32-Users@listserv.ActiveState.com
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Ken Kriesel
Oops, I see I misattributed 2 lines.

my $string = ' 259.00 ';
print "<$string>\n";
#$string =~ s/^(\s+)(?=\d)/'0'x(length $1)/e; #Mike Arms posted
$string =~ s/^(\s+)/'0'x(length $1)/e;  #Paul Sobey; quicker than above line
print "<$string>\n";

which outputs:

< 259.00 >
<0259.00 >


Ken



At 10:56 AM 4/7/2006, Paul Sobey wrote:

>> My $string = ' 259.00 ';
>> 
>> Note that I don't want to change the trailing space character. The
>> resulting string would look like:
>> 
>> '0259.00 '
>> 
>> The total length of the string would remain the same after the replace
>> operation.
>> 
>> I'm just having a total brain-fade on this one.
>
>$string =~ s/^(\s+)/'0' x length($1)/e
>
>Does that do what you want?
>
>P.
>
>*
>Gloucester Research Limited believes the information 
>provided herein is reliable. While every care has been 
>taken to ensure accuracy, the information is furnished 
>to the recipients with no warranty as to the completeness 
>and accuracy of its contents and on condition that any 
>errors or omissions shall not be made the basis for any 
>claim, demand or cause for action.
>
>The information in this email is intended only for the 
>named recipient.  If you are not the intended recipient
>please notify us immediately and do not copy, distribute 
>or take action based on this e-mail.
>
>Gloucester Research Limited, 5th Floor, Whittington House, 
>19-30 Alfred Place, London WC1E 7EA
>*
>
>___
>Perl-Win32-Users mailing list
>Perl-Win32-Users@listserv.ActiveState.com
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces (fwd)

2006-04-07 Thread Nelson R. Pardee
I've included timings for 1 iterations for each of the proposed
solutions.

0.056398  s/\s(?=\s*\S)/0/og
0.254457  while (s/\s(?=(\d|\.))/0/ {)
0.094268 s/^(\s+)(?=\d)/'0'x(length $1)/e
0.026934 (see below) Strip front space, take length diff, replace with n x "0"
0.095046 s/^(\s+)/sprintf "%s", q[0]x length($1)/eg
0.086842 s/ (?=.*\d)/0/g

Surprisingly, the more manual process is the fastest. This latest positive
lookahead is a bit slower than the first one, I'm not sure why.

--
($trimmed_string = $_) =~ s/^ *//; # remove leading spaces
$transformed_string = ('0' x ((length $_) - length
$trimmed_string)) . $trimmed_string;
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Dirk Bremer


Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO
- USA Central Time Zone
636-755-2652 fax 636-755-2503

[EMAIL PROTECTED]
www.nisc.coop 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Nelson R. Pardee
> Sent: Friday, April 07, 2006 13:20
> To: Active State Perl
> Subject: RE: Replace Leading Spaces
> 
> Try # 2:
> The first is my new one using a positive lookahead assertion.
> I've included timings for 1 iterations for each of the proposed
> solutions.
> 
> 0.056398  s/\s(?=\s*\S)/0/og
> 0.254457  while (s/\s(?=(\d|\.))/0/ {)
> 0.094268 s/^(\s+)(?=\d)/'0'x(length $1)/e
> 

Nelson,

Please add Mark Thomas' solution to your timings to see how it compares
to the others:

s/ (?=.*\d)/0/g

Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO
- USA Central Time Zone
636-755-2652 fax 636-755-2503

[EMAIL PROTECTED]
www.nisc.coop 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Thomas, Mark - BLS CTR
> Using a regex, I want to replace each leading space-character 
> with a corresponding zero-character on a one-to-one basis. 
> For an example
> string:
> 
> My $string = ' 259.00 ';
> 
> Note that I don't want to change the trailing space 
> character. The resulting string would look like:
> 
> '0259.00 '

How about

s/ (?=.*\d)/0/g;

Translation: any space with a digit to its right gets replaced with a
zero.

-- 
Mark Thomas 
Internet Systems Architect
___
BAE SYSTEMS Information Technology 
2525 Network Place
Herndon, VA  20171  USA 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Dirk Bremer

> -Original Message-
> From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 07, 2006 13:15
> To: Dirk Bremer; Perl-Win32-Users@listserv.ActiveState.com
> Subject: RE: Replace Leading Spaces
> 
> > Using a regex, I want to replace each leading space-character 
> > with a corresponding zero-character on a one-to-one basis. 
> > For an example
> > string:
> > 
> > My $string = ' 259.00 ';
> > 
> > Note that I don't want to change the trailing space 
> > character. The resulting string would look like:
> > 
> > '0259.00 '
> 
> How about
> 
> s/ (?=.*\d)/0/g;
> 
> Translation: any space with a digit to its right gets replaced with a
> zero.
> 
> -- 
> Mark Thomas 

Mark,

I also like your solution, thanks!

Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO
- USA Central Time Zone
636-755-2652 fax 636-755-2503

[EMAIL PROTECTED]
www.nisc.coop 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Nelson R. Pardee
Try # 2:
The first is my new one using a positive lookahead assertion.
I've included timings for 1 iterations for each of the proposed
solutions.

0.056398  s/\s(?=\s*\S)/0/og
0.254457  while (s/\s(?=(\d|\.))/0/ {)
0.094268 s/^(\s+)(?=\d)/'0'x(length $1)/e

On Fri, 7 Apr 2006, Dirk Bremer wrote:

> > Using a regex, I want to replace each leading space-character with a
> > corresponding zero-character on a one-to-one basis. For an example
> > string:
> >
> > My $string = ' 259.00 ';
> >
> > Note that I don't want to change the trailing space character. The
> > resulting string would look like:
> >
> > '0259.00 '
> >
> > The total length of the string would remain the same after the replace
> > operation.

 --Nelson R. Pardee, Support Analyst, Information Technology & Services--
 --Syracuse University, 211 Machinery Hall, Syracuse, NY 13244-1260--
 --(315) 443-1079 [EMAIL PROTECTED] --
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Replace Leading Spaces

2006-04-07 Thread Lyle Kopnicky

Dirk Bremer wrote:

All right, in the mean time, I have come up with the following:

while (s/\s(?=(\d|\.))/0/) {}

This works nicely, but I' wondering if it can be accomplished without
looping and perhaps more efficiently as well.

Your thoughts?
  
I think that's kind of confusing.  I like Paul's suggestion.  It's 
short, simple, I look at it and can see what it means right away.  
Here's another way, that should be pretty efficient:


my $string = ' 259.00 ';
(my $trimmed_string = $string) ~= s/^ *//; # remove leading spaces
my $transformed_string = '0' x (length $string - length $trimmed_string) 
. $trimmed_string;


--
Lyle Kopnicky
Software Project Engineer
Veicon Technology, Inc.

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Replace Leading Spaces

2006-04-07 Thread Nelson R. Pardee
On Fri, 7 Apr 2006, Nelson R. Pardee wrote:

> Don't know if this is the most efficient, but it seems to work for me...
> s/^(0?\s)/0/g;

Another brain fade!. This doesn't work.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Replace Leading Spaces

2006-04-07 Thread Nelson R. Pardee
Don't know if this is the most efficient, but it seems to work for me...
s/^(0?\s)/0/g;

On Fri, 7 Apr 2006, Dirk Bremer wrote:

> Using a regex, I want to replace each leading space-character with a
> corresponding zero-character on a one-to-one basis. For an example
> string:
>
> My $string = ' 259.00 ';
>
> Note that I don't want to change the trailing space character. The
> resulting string would look like:
>
> '0259.00 '
>
> The total length of the string would remain the same after the replace
> operation.

 --Nelson R. Pardee, Support Analyst, Information Technology & Services--
 --Syracuse University, 211 Machinery Hall, Syracuse, NY 13244-1260--
 --(315) 443-1079 [EMAIL PROTECTED] --
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote:
> Using a regex, I want to replace each leading space-character with a
> corresponding zero-character on a one-to-one basis. For an example
> string:
> 
> My $string = ' 259.00 ';
> 
> Note that I don't want to change the trailing space character. The
> resulting string would look like:
> 
> '0259.00 '
> 
> The total length of the string would remain the same after the replace
> operation.
> 
> I'm just having a total brain-fade on this one.
It was brain fade here also, but finally found one way:

#!perl

use strict;
use warnings;

$_ = '  259.00 ';
print $_ . "\n";

s/^(\s+)/sprintf "%s", q[0]x length($1)/eg;
print $_ . "\n";
Output:
  259.00
00259.00

hth

Wags ;)
> 
> Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis
> MO - USA Central Time Zone
> 636-755-2652 fax 636-755-2503
> 
> [EMAIL PROTECTED]
> www.nisc.coop
> 
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



***
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
***


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Arms, Mike
Dirk Bremer [Dirk.Bremer AT nisc.coop] wrote:
> Using a regex, I want to replace each leading space-character with a
> corresponding zero-character on a one-to-one basis. For an example
> string:
> 
>   my $string = ' 259.00 ';
> 
> Note that I don't want to change the trailing space character. The
> resulting string would look like:
> 
> '0259.00 '
> 
> The total length of the string would remain the same after the
> replace operation.

Hi, Dirk,

You mean something like this?

  $string =~ s/^(\s+)(?=\d)/'0'x(length $1)/e; 

The power of the 'e' modifier on the substitution function. :-)

--
Mike Arms


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Dirk Bremer

> -Original Message-
> From: Arms, Mike [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 07, 2006 11:37
> To: Perl-Win32-Users@listserv.ActiveState.com
> Cc: Dirk Bremer
> Subject: RE: Replace Leading Spaces
> 
> Dirk Bremer [Dirk.Bremer AT nisc.coop] wrote:
> > Using a regex, I want to replace each leading space-character with a
> > corresponding zero-character on a one-to-one basis. For an example
> > string:
> > 
> >   my $string = ' 259.00 ';
> > 
> > Note that I don't want to change the trailing space character. The
> > resulting string would look like:
> > 
> > '0259.00 '
> > 
> > The total length of the string would remain the same after the
> > replace operation.
> 
> Hi, Dirk,
> 
> You mean something like this?
> 
>   $string =~ s/^(\s+)(?=\d)/'0'x(length $1)/e; 
> 
> The power of the 'e' modifier on the substitution function. :-)
> 
> --
> Mike Arms
> 

Now that one is pretty darn cool and something I didn't know about.
Thanks Mike!

Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO
- USA Central Time Zone
636-755-2652 fax 636-755-2503

[EMAIL PROTECTED]
www.nisc.coop  

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Replace Leading Spaces

2006-04-07 Thread Trevor Joerges

Using a regex, I want to replace each leading space-character with a
corresponding zero-character on a one-to-one basis. For an example
string:

My $string = ' 259.00 ';

Note that I don't want to change the trailing space character. The
resulting string would look like:

'0259.00 '

The total length of the string would remain the same after the replace
operation.

I'm just having a total brain-fade on this one.




Perl sprintf or printf built-in function. 


'perldoc -f sprintf'

printf '<%06s>', 12;  # prints "<12>"
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Dirk Bremer

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Dirk Bremer
> Sent: Friday, April 07, 2006 09:52
> To: Perl-Win32-Users@listserv.ActiveState.com
> Subject: Replace Leading Spaces
> 
> Using a regex, I want to replace each leading space-character with a
> corresponding zero-character on a one-to-one basis. For an example
> string:
> 
> My $string = ' 259.00 ';
> 
> Note that I don't want to change the trailing space character. The
> resulting string would look like:
> 
> '0259.00 '
> 
> The total length of the string would remain the same after the replace
> operation.
> 
> I'm just having a total brain-fade on this one.
> 

All right, in the mean time, I have come up with the following:

while (s/\s(?=(\d|\.))/0/) {}

This works nicely, but I' wondering if it can be accomplished without
looping and perhaps more efficiently as well.

Your thoughts?

Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO
- USA Central Time Zone
636-755-2652 fax 636-755-2503

[EMAIL PROTECTED]
www.nisc.coop 

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Replace Leading Spaces

2006-04-07 Thread Paul Sobey

> My $string = ' 259.00 ';
> 
> Note that I don't want to change the trailing space character. The
> resulting string would look like:
> 
> '0259.00 '
> 
> The total length of the string would remain the same after the replace
> operation.
> 
> I'm just having a total brain-fade on this one.

$string =~ s/^(\s+)/'0' x length($1)/e

Does that do what you want?

P.

*
Gloucester Research Limited believes the information 
provided herein is reliable. While every care has been 
taken to ensure accuracy, the information is furnished 
to the recipients with no warranty as to the completeness 
and accuracy of its contents and on condition that any 
errors or omissions shall not be made the basis for any 
claim, demand or cause for action.

The information in this email is intended only for the 
named recipient.  If you are not the intended recipient
please notify us immediately and do not copy, distribute 
or take action based on this e-mail.

Gloucester Research Limited, 5th Floor, Whittington House, 
19-30 Alfred Place, London WC1E 7EA
*

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Replace Leading Spaces

2006-04-07 Thread Dirk Bremer
Using a regex, I want to replace each leading space-character with a
corresponding zero-character on a one-to-one basis. For an example
string:

My $string = ' 259.00 ';

Note that I don't want to change the trailing space character. The
resulting string would look like:

'0259.00 '

The total length of the string would remain the same after the replace
operation.

I'm just having a total brain-fade on this one.

Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO
- USA Central Time Zone
636-755-2652 fax 636-755-2503

[EMAIL PROTECTED]
www.nisc.coop

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


WMI Querying - Slightly OT

2006-04-07 Thread Paul Sobey
Using the attached WMIExplore.pl, enumerating the
Win32_PerfRawData_Tcpip_NetworkInterface class on most of my servers
gives information similar to the following:

D:\CVS\secure\scripts\SystemsMonitoring>WMIExplore.pl
Win32_PerfRawData_Tcpip_NetworkInterface l3pinfra1
Collecting WMI data from l3pinfra1 for
Win32_PerfRawData_Tcpip_NetworkInterface
===
BytesReceivedPersec -> 791744567 -> PERF_COUNTER_COUNTER
BytesSentPersec -> 1209514631 -> PERF_COUNTER_COUNTER
BytesTotalPersec -> 2001259198 -> PERF_COUNTER_BULK_COUNT
Caption ->  ->
CurrentBandwidth -> 1 -> PERF_COUNTER_RAWCOUNT
Description ->  ->
Frequency_Object -> 0 ->
Frequency_PerfTime -> 339179 ->
Frequency_Sys100NS -> 1000 ->
Name -> Intel[R] PRO_1000 MT Network Connection _2 ->


We have a farm of servers with 4 GB NICs teamed, so that the live
interface has a bandwidth of 4 GB/s. Running the same code on one of
these machines shows this:

D:\CVS\secure\scripts\SystemsMonitoring>WMIExplore.pl
Win32_PerfRawData_Tcpip_NetworkInterface l3pcalcamd2
Collecting WMI data from l3pcalcamd2 for
Win32_PerfRawData_Tcpip_NetworkInterface
===
BytesReceivedPersec -> 1850144995 -> PERF_COUNTER_COUNTER
BytesSentPersec -> -876640650 -> PERF_COUNTER_COUNTER
BytesTotalPersec -> 973504345 -> PERF_COUNTER_BULK_COUNT
Caption ->  ->
CurrentBandwidth -> -294967296 -> PERF_COUNTER_RAWCOUNT
Description ->  ->
Frequency_Object -> 0 ->
Frequency_PerfTime -> 260600 ->
Frequency_Sys100NS -> 1000 ->
Name -> HP Network Team _1 ->


The CurrentBandwidth property is a negative value, almost as if it is a
counter that has wrapped. Does anybody know how I can process this to
get the true value?

Cheers,
Paul

*
Gloucester Research Limited believes the information 
provided herein is reliable. While every care has been 
taken to ensure accuracy, the information is furnished 
to the recipients with no warranty as to the completeness 
and accuracy of its contents and on condition that any 
errors or omissions shall not be made the basis for any 
claim, demand or cause for action.

The information in this email is intended only for the 
named recipient.  If you are not the intended recipient
please notify us immediately and do not copy, distribute 
or take action based on this e-mail.

Gloucester Research Limited, 5th Floor, Whittington House, 
19-30 Alfred Place, London WC1E 7EA
*


WMIExplore.pl
Description: WMIExplore.pl
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: CGI OR NOT

2006-04-07 Thread DZ-Jay


On Apr 6, 2006, at 18:03, So Phal wrote:


Hi
I want to know whether using CGI and using pain html is faster or what?
If I use CGI to generate the html and write pain html code inside Perl 
to generate Html. I believe write pain html inside Perl is more faster 
then CGI generate html code.

 
What do you think ?



I'm not sure I understand what you want to know... what do you mean 
with "pain html"?  And what exactly do you mean by using "CGI"?  CGI is 
an interface, a set of rules, for communicating between he web server 
and a server-side program.


dZ.


--
$question = ( /(bb|[^b]{2})/ );

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: CGI OR NOT

2006-04-07 Thread Chris Wagner
At 03:03 PM 4/6/2006 -0700, So Phal wrote:
>I want to know whether using CGI and using pain html is faster or what?
>If I use CGI to generate the html and write pain html code inside Perl to
>generate Html. I believe write pain html inside Perl is more faster then CGI
>generate html code.

I assume u mean "plain" html.  I don't think u understand what CGI is.  CGI
is the "gateway" that allows any script to output data through a web server
to a client.  In what u propose, perl is running as a CGI script.  Having
perl output html will be pretty fast, since it's just printing text.  Having
a static html document however will be even faster since there's no
processing involved.  If u just need to output plain text then having static
files is better.







--
REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
"...ne cede malis"

0100

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs