Re: Strings ?! ( reloaded )
[EMAIL PROTECTED] wrote: > Hello guys, > > Now I am testing the following piece of code : > sub TestSubstr > { > >$_ = "EMail : [EMAIL PROTECTED]"; >$testFor = "EMail"; >if ( /^(\s*)($testFor\s{1}:)/) >{ > print "+ is $+[0] \n"; > # until now I did like the following two lines to get the email address > from a field like the $_ ( example ) > my $eee = substr($_,$+[0]); > print "--- $eee \n"; > # I have read the perldoc -f substr doc and I saw there that is not a > good way to do substr and to specify the offset > # and I decided to try like the next two lines > my $_EMail = substr($',0); > print " _Email is $_Email \n"; >} > } > > TestSubstr ; > > === > Now the problem is that I expect to get my email address out of that > string but I get something like e.nl !!!??? > Any ideea where I go wrong ? You should be ashamed of yourself for not testing your script with strict and warnings turned on. Try this version and do everyojne a favor and don't leave out the first two lines. use strict; use warnings; TestSubstr ("EMail : [EMAIL PROTECTED]"); TestSubstr (' EMail : [EMAIL PROTECTED]'); sub TestSubstr { local $_ = shift; my $testFor = "EMail"; if (/^(\s*)($testFor\s{1}:\s*)/) { print "+ is $+[0]\n"; my $eee = substr $_, $+[0]; print "--- '$eee'\n"; my $EMail = substr $', 0; print "Email is '$EMail'\n"; } } __END__ -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Strings ?! ( reloaded )
You might try putting a "\" before the "@" ... e.g. "$_ = "EMail : [EMAIL PROTECTED]"; HTH, Greg Williamson DBA GlobeXplorer LLC -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tue 9/14/2004 2:37 AM To: [EMAIL PROTECTED] Cc: Subject:Strings ?! ( reloaded ) Hello guys, Now I am testing the following piece of code : sub TestSubstr { $_ = "EMail : [EMAIL PROTECTED]"; $testFor = "EMail"; if ( /^(\s*)($testFor\s{1}:)/) { print "+ is $+[0] \n"; # until now I did like the following two lines to get the email address from a field like the $_ ( example ) my $eee = substr($_,$+[0]); print "--- $eee \n"; # I have read the perldoc -f substr doc and I saw there that is not a good way to do substr and to specify the offset # and I decided to try like the next two lines my $_EMail = substr($',0); print " _Email is $_Email \n"; } } TestSubstr ; === Now the problem is that I expect to get my email address out of that string but I get something like e.nl !!!??? Any ideea where I go wrong ? Regards, Nicu ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Strings ?! ( reloaded )
Title: Strings ?! ( reloaded ) Hello guys, Now I am testing the following piece of code : sub TestSubstr { $_ = "EMail : [EMAIL PROTECTED]"; $testFor = "EMail"; if ( /^(\s*)($testFor\s{1}:)/) { print "+ is $+[0] \n"; # until now I did like the following two lines to get the email address from a field like the $_ ( example ) my $eee = substr($_,$+[0]); print "--- $eee \n"; # I have read the perldoc -f substr doc and I saw there that is not a good way to do substr and to specify the offset # and I decided to try like the next two lines my $_EMail = substr($',0); print " _Email is $_Email \n"; } } TestSubstr ; === Now the problem is that I expect to get my email address out of that string but I get something like e.nl !!!??? Any ideea where I go wrong ? Regards, Nicu ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::Shell::Execute Alternative
> Huub Peters wrote: > > > I've written a gui application with wxPerl and I want to be able to execute > > a (known) file from within the application (it's a list of files to be > > attached to an e-mail) > > So for example, when I attached a xls file (Excel) or an url I want to be > > able to view it. Up till now I used the following to launch the accosiated > > application: > > > > Win32::Shell::Execute("open", 'c:\test.xls', -1, -1, SW_SHOWNORMAL); > > or > > Win32::Shell::Execute("open", 'http://www.perl.com', -1, -1, SW_SHOWNORMAL); > > > > This works fine on most systems but I recently found out that Windows NT has > > a problem with this. Only rarely does it execute (some url's) but most of > > the time we get a visit from Dr.Watson claiming Explorer.exe performed an > > illegal operation and crashes. The type of errors varies with what was > > executed but the bottom line is that it fails on Win NT. > > > > I'm pretty sure there's an alternative way to accomplish the same thing and > > was thinking along the lines of Win32::Process or something similar. > > > > I recently bought copies of 'Win32 Perl Scripting' and 'Win32 Perl > > Programming' and think it should be in there somewhere but after wading > > through a few chapters I thought maybe someone on the list has a suggestion. > > Have you tried just using the start command ? system "start c\\:test.xls"; > Just a note to tell how I fixed it and to complete the archives. The start command gave exactly the same problem on WinNT on top of flashing a command box on execution (It's a wxPerl GUI-app run as a PerlApp standalone exe). I didn't try the Win32::API suggestion Dax gave me but it led me to Jenda's Win32::FileOp which uses the ShellExecute internally. The reason I didn't try Dax's suggestion is because you have to know what program has to be launched beforehand. I needed a solution that mimics clicking on a shortcut. use Win32::FileOp qw(:BASIC ShellExecute); my $filename = $info->GetText; ShellExecute 'open' => $filename; Worked like a charm :-) > ___ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: GMP library
Jutu Subramanian, Srinivasan (Cognizant) wrote: Hi, Anybody know how to install the GMP library in windows box. Probably simplest for you to run: ppm install http://theoryx5.uwinnipeg.ca/ppms/Math-GMP.ppd That will install a Math::GMP that has been built against a static GMP library - so you won't even have to install the GMP library. For some alternatives see: http://www.kalinabears.com.au/w32perl/math_gmp.html Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs