Re: Easy One

2006-05-02 Thread David Kaufman
Hi Bill (in Brooklyn), Ng, Bill <[EMAIL PROTECTED]> wrote: > Real simple, > > I have a string, "$a" for arguments sake, that contains a single > word. The word will always have exactly 8 characters in it, most > likely something like "ABCD1234". I need to split this up into two > strings ($b &

Re: Easy One

2006-05-02 Thread $Bill Luebkert
Timothy Johnson wrote: > if ($str =~ /^(?=.{8}$)(\D+)(\d+)$/){ I like it - solves both problems. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: [perl-win32] Re: Tk beep on Win2K?

2006-05-02 Thread Lyle Kopnicky
Robert May wrote: #!perl -w use strict; use warnings; use Win32::API(); Win32::API->Import("Kernel32", "Beep", "LL", "L"); Beep(750, 300); __END__ Yes, that one works! In both RDP and ICA, even with wperl. It works on NT4 and Win2K. Thank you. -- Lyle Kopnicky Software Project Engineer Vei

Re: Easy One

2006-05-02 Thread $Bill Luebkert
$Bill Luebkert wrote: > Luke Bakken wrote: > > > What is the purpose of this illustration in the context of the > >>original stated problem? The original problem stated that the string >>will have different numbers of alphabetic characters and numbers while >>your regex specifies 4 digits exact

RE: Easy One

2006-05-02 Thread Timothy Johnson
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of $Bill Luebkert Sent: Tuesday, May 02, 2006 5:42 PM To: perl-win32-users@listserv.ActiveState.com Subject: Re: Easy One >> The original problem stated that the string >> will have different numbers of alpha

Re: Easy One

2006-05-02 Thread $Bill Luebkert
Luke Bakken wrote: > What is the purpose of this illustration in the context of the > original stated problem? The original problem stated that the string > will have different numbers of alphabetic characters and numbers while > your regex specifies 4 digits exactly. My code was in reference to

RE: Easy One

2006-05-02 Thread Timothy Johnson
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luke Bakken Sent: Tuesday, May 02, 2006 6:16 AM To: Timothy Johnson Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: Easy One >> >> I have a string, "$a" for arguments sake, that contains

Re: Easy One

2006-05-02 Thread Luke Bakken
>Maybe you're used to some old behavior in Perl, but that doesn't >appear to be the case in 5.8.8 at least. I get this output: Ah. Okay, I see why that worked now. $1, $2 et al are scoped to the current block, so in this case you are right. If you were to do two pattern matches within the

RE: Easy One

2006-05-02 Thread Suresh Govindachar
[resending with a better counter-example] Luke Bakken wrote: >>> use strict; >>> >>> my $str = ''; >>> matchit(); >>> $str = ''; >>> matchit(); >>> >>> sub matchit >>> { >>> if (length $str == 8) { >>> $str =~ /^(\D+)(\d+)$/; >>>

RE: Easy One

2006-05-02 Thread Suresh Govindachar
Luke Bakken wrote: >>> use strict; >>> >>> my $str = ''; >>> matchit(); >>> $str = ''; >>> matchit(); >>> >>> sub matchit >>> { >>> if (length $str == 8) { >>> $str =~ /^(\D+)(\d+)$/; >>> print "\$1 $1 \$2 $2\n"; >>>

Re: Easy One

2006-05-02 Thread Luke Bakken
I have a string, "$a" for arguments sake, that contains a >> >>single >> word. The word will always have exactly 8 characters in it, most >> >>likely >> something like "ABCD1234". I need to split this up into two strings >> >>($b >> >> >> >>>if (length $string == 8) # might a

Re: Easy One

2006-05-02 Thread $Bill Luebkert
Luke Bakken wrote: I have a string, "$a" for arguments sake, that contains a >> >>single >> word. The word will always have exactly 8 characters in it, most >> >>likely >> something like "ABCD1234". I need to split this up into two strings >> >>($b >> >> >> >>>if (length $str

RE: Easy One

2006-05-02 Thread Nelson R. Pardee
Ah, you made me go back and reread the manual on this. It does sound like it doesn't matter if there's no variable to interpolate. Although- when I recently did some timing, it seemed to make a very slight difference. On Tue, 2 May 2006, Timothy Johnson wrote: > Why did you add the "o"? I believ

Re: Easy One

2006-05-02 Thread Luke Bakken
>> I have a string, "$a" for arguments sake, that contains a single >> word. The word will always have exactly 8 characters in it, most likely >> something like "ABCD1234". I need to split this up into two strings ($b > >if (length $string == 8) # might as well check eh? >{ >$stri

RE: Easy One

2006-05-02 Thread Timothy Johnson
Why did you add the "o"? I believe you should only need that if you are storing the regex in a scalar for reuse. Otherwise I think the regex will still be compiled once for each iteration. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nelson R. Pardee

Re: Tk beep on Win2K?

2006-05-02 Thread Chris Wagner
At 12:53 PM 5/1/2006 -0700, Lyle Kopnicky wrote: >I can do that, by typing ^G in the console and hitting Enter. > >But I can't do it from a Perl program, running via wperl. Naturally. ^G requires a terminal to play the ding sound to the speaker. wperl has no terminal so no sound. Everything wper