RE: Importing Identifiers from Main::

2005-06-30 Thread L. Neil Johnson
On Wednesday, June 29, 2005 3:10 AM, Sisyphus [SMTP:[EMAIL PROTECTED] wrote: > > "Perl in a Nutshell" is quite correct here, I think. If the module does not > have a package name (which is rarely the case) then $var, $::var, and > $main::var are all the same thing. > > D:\pscrpt>type trial.pm > >

RE: Test if a string is a number?

2005-06-30 Thread LeHobbit
Try this simple code : if ($x+0 != 0 or $x =~ /^t/i ) { return 1; } else { return 0; } -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Lyle Kopnicky Envoyé : mercredi 29 juin 2005 23:53 À : perl-win32-users Objet : Test if a string is a number

Re: Active Directory: GPOs

2005-06-30 Thread Matt Clark
Alan, Also, be aware that Group Policy refresh is not instant... by default, it refreshes every 90 minutes + a random interval of up to 30 minutes (so every 90 to 120 minutes). If you need the timing to be very precise, you should schedule gpupdate.exe to run on all your systems at a time just

Re: Importing Identifiers from Main::

2005-06-30 Thread Sisyphus
- Original Message - From: "L. Neil Johnson" <[EMAIL PROTECTED]> To: "'Sisyphus'" <[EMAIL PROTECTED]> Cc: "'Win32-Users'" Sent: Thursday, June 30, 2005 4:22 PM Subject: RE: Importing Identifiers from Main:: > On Wednesday, June 29, 2005 3:10 AM, Sisyphus [SMTP:[EMAIL PROTECTED] > wrote

RE: Importing Identifiers from Main::

2005-06-30 Thread Johan Lindstrom
At 07:34 2005-06-30, L. Neil Johnson wrote: As mentioned previously, I got tired of editing the absolute indices (e.g., $trade[$i]->[6]) every time the order or meaning of an element of the anonymous arrays changed; so in main I defined typeglobs: This is what I meant when I said a hash is a

Re: Importing Identifiers from Main::

2005-06-30 Thread $Bill Luebkert
L. Neil Johnson wrote: > Thank you for responding. Sorry about the ambiguity. The main program is a > sequence of computational processes that reads several files of 20K to 50K > records and splits them into 12 parallel arrays of that length. Analytic > routines generate an array (@trade) of

Re: Importing Identifiers from Main::

2005-06-30 Thread $Bill Luebkert
$Bill Luebkert wrote: > # using constants (but you have to export them to the other module like > your glob refs): > > use constant xbi => 0;# index into data arrays, begin time > use constant xei => 1;# index into data arrays, end time > use constant xi => 2;# indicator

Re: Perl Constants (was RE: mystery)

2005-06-30 Thread Chris Wagner
At 05:29 PM 6/29/05 -0400, John Deighan wrote: >use strict; >use constant X => 23; >my $y = X - 2; >print("y = $y\n"); > >To my amazement, it actually printed out "y = 21". So, using the "use >constant" construct actually gave the correct result. In fact, I tried, >just for the heck of it, to cha

Re: Test if string is a number?

2005-06-30 Thread Chris Wagner
Wow there's been a lot of heavy duty code proposed to do something so simple. The answer is in how Perl converts between the two. print "is a number" if $var eq $var + 0; print "not a number" if $var ne $var + 0; Say $var is "bob". In the first case we see if "bob" is string equal to bob + 0 or

Re: mystery

2005-06-30 Thread eric-amick
"use constant" defines constants something like this:   sub NAME() { return 42;}   The prototype prevents anything following a reference to the constant from being accepted as an argument. What's more, Perl will inline the function call if the return value is a constant _expression_ in most cases.

RE: Test if string is a number?

2005-06-30 Thread Thomas, Mark - BLS CTR
> Wow there's been a lot of heavy duty code proposed to do something so > simple. The answer is in how Perl converts between the two. > > print "is a number" if $var eq $var + 0; > print "not a number" if $var ne $var + 0; That fails on 1e7. ___ Perl-

RE: Test if string is a number?

2005-06-30 Thread Joe Discenza
Title: Re: Test if string is a number? Chris Wagner wrote, on Thu 6/30/2005 08:48 : Wow there's been a lot of heavy duty code proposed to do something so: simple.  The answer is in how Perl converts between the two.:: print "is a number" if $var eq $var + 0;: print "not a number" if $var

Re: Test if string is a number?

2005-06-30 Thread $Bill Luebkert
Chris Wagner wrote: > Wow there's been a lot of heavy duty code proposed to do something so > simple. The answer is in how Perl converts between the two. > > print "is a number" if $var eq $var + 0; > print "not a number" if $var ne $var + 0; > > Say $var is "bob". In the first case we see if "

Re: Test if string is a number?

2005-06-30 Thread Siebe Tolsma
Title: Re: Test if string is a number? How about regexp?   /^\-?(\d+\.?\d*|\.\d+)$/ - Original Message - From: Joe Discenza To: Chris Wagner ; perl-win32-users Sent: Thursday, June 30, 2005 4:48 PM Subject: RE: Test if string is a number? Chris Wagner

RE: Test if string is a number?

2005-06-30 Thread Andreas.Kamentz
For a long time I'm using the function below to test for a number, being quite satisfied with it ... # (nmb) number # Returns decimal value of the contents if argument # is a number (integer if octal or hexadecimal), # otherwise returns empty

RE: Test if string is a number?

2005-06-30 Thread Chris Wagner
At 09:48 AM 6/30/05 -0500, Joe Discenza wrote: >Except if $var is, say, '0.00'. Then $var + 0 is '0', and won't eq $var. 0.00 is not a valid internal representation of a number. That can only exist as a string. Same goes for "1e7". That is a print formated number, not a valid internal number.

RE: Test if string is a number?

2005-06-30 Thread Thomas, Mark - BLS CTR
[EMAIL PROTECTED] wrote: > 0.00 is not a valid internal representation of a number. > That can only exist as a string. I think "u" need to re-read the subject of this thread. - Mark. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.Acti

RE: Test if string is a number?

2005-06-30 Thread Joe Discenza
Title: RE: Test if string is a number? Chris Wagner wrote, on Thu 6/30/2005 12:41 : At 09:48 AM 6/30/05 -0500, Joe Discenza wrote:: >Except if $var is, say, '0.00'. Then $var + 0 is '0', and won't eq $var.:: 0.00 is not a valid internal representation of a number.  That can only: exist as

RE: Test if string is a number?

2005-06-30 Thread Chris Wagner
At 12:16 PM 6/30/05 -0500, Joe Discenza wrote: >I bet you're right that "eval($var) eq $var + 0" works; have you benchmarked it against all the other (regex, e.g.) methods presented? I haven't benchmarked it but I can garuntee that it's faster than a regex. Anything's faster than that. ;) This sh

RE: Test if string is a number?

2005-06-30 Thread Joe Discenza
Title: RE: Test if string is a number? Chris Wagner wrote, on Thu 6/30/2005 14:41 : At 12:16 PM 6/30/05 -0500, Joe Discenza wrote:: >I bet you're right that "eval($var) eq $var + 0" works; have you: >benchmarked it against all the other (regex, e.g.) methods presented?:: I haven't benchma

Re: Test if string is a number?

2005-06-30 Thread $Bill Luebkert
Joe Discenza wrote: > Chris Wagner wrote, on Thu 6/30/2005 14:41 > > : At 12:16 PM 6/30/05 -0500, Joe Discenza wrote: > : >I bet you're right that "eval($var) eq $var + 0" works; have you > : >benchmarked it against all the other (regex, e.g.) methods presented? > : > : I haven't benchmarked it b

RE: Test if string is a number?

2005-06-30 Thread Chris Wagner
At 02:28 PM 6/30/05 -0500, Joe Discenza wrote: >Regex is pretty fast. Eval is usually pretty slow. Yeah ur right about the eval. I did a triple head to head with ur regex and eval/no eval. The eq without the eval demolishes all. Rate evalRE noeval eval3397/s -- -87% -

system() Conundrum

2005-06-30 Thread Roy Olsen
I have a Perl script that receives programs and other files from a host system for editing. Once the file is transferred the script launches my text editor and passes it the name of the file. It works fine for me and several colleagues. However, on one user's brand new system (with XP Pro

Re: system() Conundrum

2005-06-30 Thread $Bill Luebkert
Roy Olsen wrote: > I have a Perl script that receives programs and other files from a host > system for editing. Once the file is transferred the script launches my > text editor and passes it the name of the file. It works fine for me and > several colleagues. However, on one user's brand

Re: system() Conundrum

2005-06-30 Thread Leigh Sharpe
What about using Win32::Process::Create? - Original Message - From: "Roy Olsen" <[EMAIL PROTECTED]> To: Sent: Friday, July 01, 2005 11:56 AM Subject: system() Conundrum > > I have a Perl script that receives programs and other files from a host > system for editing. Once the file is