Re: CGI Help for a Newbie...
[EMAIL PROTECTED] wrote: > To the Point (the question): If I install ActiveState > Perl onto a non-internet connected computer, can I > create an HTML file (client side) that has a form that > submits to a CGI file (client side - same computer) > and uses that data to create some MS word documents > from some templates? > The short answer would seem to be no, I need a server > on there, such as FrontPage or Apache, which is a bit > more in depth and requires more computer resources > than I want to commit. However, if you can't do this > how do you debug a CGI script before putting it on the > server side. There are various things you can do: First, you should join the Perl-Win32-Web mailing list. Second, you should code your CGI using the Perl CGI module. This lets you test the script interactively, and pass any CGI arguments on the command line. Output is checked either by eyeballing the HTML or redirecting it to a file and opening that file in your favorite browser. At least during testing, you may want to use CGI::Pretty rather than CGI, so your output gets formatted "nicely" and you can eyeball it better. I also recommend CGI::Carp qw{fatalsToBrowser}. In fact, I recommend that your script start thusly: #!path_to_perl_executable (if you're using Apache) use strict; use warnings; use CGI::Pretty qw{:standard}; use CGI::Carp qw{fatalsToBrowser}; # Here follows the script to generate your web page. For example: my $name = param ('name') || 'World'; my $text = "Hello, $name!"; print header, start_html ($text), h1 ({align => 'center'}, $text), end_html; #disclaimer - the above is not guaranteed to compile, much less #execute. __END__ You might (and in fact probably will) want to tweak what you import from CGI (or equivalently CGI::Pretty); ':standard' is just the bare bones. I'm told that Lynx will execute CGI scripts and display the results, but I haven't done this, and if you're checking the look-and-feel, Lynx tells you very little about what your data will look like using a GUI browser like Internet Explorer of Mozilla. But be aware that the only way to tell if your CGI script works with a given web server is to run it via that web server. There are a lot of things that can go wrong. For example, the web server won't give the script the same default directory as you develop under, and will almost certainly have more restricted file access than you do. It may (depending on the server - e.g. Apache) not import all the environment variables you see interactively. Or it may not know how to execute Perl scripts (IIS: missing or incorrect file association, and under Windows 2003 you have to do some extra and _very_ obscurely documented setup; Apache: incorrect or missing shebang line, or server not configured to use file association, or missing or incorrect association.) I really recommend installing a web server on your development machine. IIS is easier to set up (especially if you're requiring an explicit username/password), but Apache is lighter-weight. Further than that I won't comment; last time I did in this forum the flame war lasted for days. Given the choice, you should prefer on your development machine the web server you're targeting. You can certainly cross-develop, and I do. It just means you'll need to learn the idiosyncracies of more than one web server. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Hash of arrays
"Daniel Gross" <[EMAIL PROTECTED]> writes: > I running into problems again: This time I'd like to fill a hash > with arrays, however, the following push command generates a > syntax error. Any idea why > My %dirHash = (); > foreach my $item(@dirArray) { > $prefix = substr($item, 0,4); > push @dirHash{$prefix}, $item; > } You can't push onto a hash. The syntax @dirHash{$prefix} is a hash slice. Q.E.D. I'm not quite sure what you're trying to do. Is it that you may have multiple items per prefix, and you want them all in the same hash element? If so, what you want is more like the following. Caution - cold code follows: foreach my $item (@dirArray) { $prefix = substr ($item, 0, 4); push @{$dirHash{$prefix}}, $item; } Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: REQUIRE command
[EMAIL PROTECTED] wrote: > Is it possible to use the require command from a perl script on one > server, to access a library located on a different server?? > For example: > require "http://www.dokos-gr.net/RWAPSoft/cgi-bin/my_lib.pl"; Yes and no. Or maybe no and yes. Or maybe just no. As was noted on the previous, a URL won't work out of the box. You could roll your own quick-and-dirty using LWP and the 'eval' function. If the module were available via (e.g.) a UNC name, that would work. But you have to be careful with web servers. Www.dokos-gr.net is running Apache, and /cgi-bin/ is _usually_ for CGI scripts. So if RWAPSoft/cgi-bin is configured as a CGI directory, what you'll get back is the results of _running_ the script, not the script itself. Besides, you suffer whatever latency is involved in fetching the file over the net. Okay, I'll bite. Why in the world would you want to do this in the first place? Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Delete
"Krishna, Hari" <[EMAIL PROTECTED]> wrote: > I have written a perl program that downloads the files (basically > ftp in a batch program) from the unix systems to windows. These files > contain the ping information to various unix systems that we use. The > program then calculates the uptime and downtime quarterly for these systems. > everything looks good. > Having said that, once I download the files from unix box, I would want to > delete those files that I just ftped to my windows folder, from the unix, in > the same batch file or perl file. Is it possible? > 2) how do I login to unix from windows? > 3) How do I start script on unix from windows? You need an account with write access to delete the files. Why not just use that account for the FTP operation, and use the FTP 'delete' command? Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How do one determine the amount of memory used by an process withinperl
"Mundell, R. \(Ronald\)" <[EMAIL PROTECTED]> wrote: > I am busy writing a script that will determine the status of an application. > I also need to determine the amount of memory used by such an application. > If anyone knows how to do this within perl please help. This solution needs > to be platform independent. Well, it depends on what you mean by platform independent. All the off-the-shelf modules I know of to get memory use under Windows start with Win32::, so that argues that there's no such beast readily available. On the other hand, a lot of the Perl modules we think of as being platform-independent work by being platform-dependent, but hiding that dependence from the user. File::Spec is an example that comes readily to mind. If I were in your shoes I would write my own superclass, and then subclass or delegate as needed based on the contents of $^O. Of course, when you get to $^O eq 'MSWin32' you have the same problem over again, since there is _no_ way I know of that works with every conceivable flavor. WMI is their current darling, but is it available and has it been retrofitted to all the systems you're worried about? If not, the APIs for NT and non-NT are different, and you'll need to provide both if you have both. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: MS Win 2K Version
"LViale - TiscaliNet" <[EMAIL PROTECTED]> wrote: > Does someone know how to get from registry the exact version of MS > Win 2k (Professional, Server, Advanced Server, ...). The WMI Win32_OperatingSystem object has attribute "Caption" which says " Microsoft Windows 2000 Professional" on my desktop machine, and "Microsoft Windows 2000 Server" on a Windows 2000 server. I do not know whether WMI will report an advanced server, but it's easy enough to someone who has access to one to check. Dave Roth's page has a bunch of sample scripts at http://www.roth.net/perl/scripts/ that should give you a leg up. Check wmi-generic.pl (under "Administrative"), and QueryOS.pl (under "WMI"). Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Having trouble installing Bundle::LWP or is it Libwww-Perl?
Glenn Linderman <[EMAIL PROTECTED]> wrote: > And my "missing feature" PPM rant is that it would be nice to be > able to issue PPM commands to prepare a CD containing a collection > of modules and their dependencies to take to an offline machine > (there are places where there just isn't local access to the > internet, and I have some friends that live in such a place). Interesting rant. Is there any reason you _must_ have PPD build the CD? Or do you just want the CD? Because I believe the CD itself would be easy enough to build. Try the following: 1) Download the .zip files you want from ActiveState 2) Create a working directory 3) Expand the zip files into the working directory 4) Burn the CD from the working directory. When you do the installs from the CD, put a '.ppd' on the end of the module name, and give PPM enough of a file name to actually find the .ppd. I like to cd (not 'CD') to the directory that contains the .ppd files, and then (for example): ppm install Crypt-SSLeay.ppd I have done all the above except burning the CD, and it works. A network-based repository is also really easy. Replace step 4 above with: 4) Install the web server of your choice, if necessary. 5) Tie your working directory into its directory hierarchy. In this case, you'll either set up the URL of the working directory as a library in PPM, or type the full URL of the .ppd file (including the '.ppd'). This is my preferred alternative, since CDs are a pain to carry around. But I'm dealing with a large corporate network where not all the machines are allowed outside. Your milage may vary. When putting non-ActiveState modules in the custom repository, I always find myself editing the .ppd files. I'm not sure it's a requirement, or just a preference on my part, or simply cargo cult programming. As for your point on module presence and currency, it's hard to rant about something that's free, but the point itself is valid. And it's one reason I established my own repository. I don't know quite what the issue is. For a while, I thought it was that 5.8 was consuming all the resources. I believe the official line is that when a module builds under Wintel it will be picked up "automagically" from CPAN. Or something like that. But I _also_ believe it's not hard to name modules which _do_ build (or don't need building) and yet aren't in the ActiveState repository. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Search a free Perl debugger
[EMAIL PROTECTED] > Hi, > I have to debug my scripts. But i don't know a free Perl debugger. > Can you recommand me one. > Thank you > -- > MESSAGE PROMOTIONNEL > HOROSCOPE > Travail, argent, rencontres... Les astres vous répondent ! > Retrouvez votre horoscope personnalisé au 0 892 02 61 60 (0,34 /mn). > http://www.europe1.fr/communiquer/mobiles/aud_horoscope.jsp Have you consulted the stars? If they're silent (work, money, encounters, but not software, eh?) try Open Perl IDE at http://sourceforge.net/projects/open-perl-ide/. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Quick way to search for path/filename combos of a particular length?
"Jeff DuVall" <[EMAIL PROTECTED]> > Is there an easy way to search a directory tree for path/filename combinations of > a particular length? I'm troubleshooting a issue with some software, and want to > rule out that the possibility of having path/filename combinations of >260 > characters. _THIS_ looks like a job for (tadaa) File::Find. Tom Wyant #!/usr/bin/perl use strict; use warnings; use File::Basename; use File::Find; use Getopt::Long; my %opt = ( longer => 64, ); GetOptions (\%opt, qw{longer=i}) or die <<"-- usage end --"; Find files matching certain criteria. usage: perl @{[basename $0]} [options] file ... Looks at all files specified (searching subdirectories), and reports those that match the given criteria, specified in the options. Because this is just a demo, the only option is -longer n -- Full path names longer than n (default: 64) -- usage end -- find (\&checker, @ARGV); sub checker { print "$File::Find::name\n" if length $File::Find::name > $opt{longer}; } This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: use lib $ENV{'PTI_CGI_HOME'};
"theatrale" <[EMAIL PROTECTED]> > in all my perl programs, there is a line to include my own libray : > use lib $ENV{'PTI_CGI_HOME'}; > I wonder how to declare "PTI_CGI_HOME" and where (in apache ?). This is not an Apache mailing list. Further, you did not provide the version of Apache you are using. But if it _were_ an Apache mailing list, you would have been directed to the documentation, which comes with your version of Apache, and is also available at http://httpd.apache.org/docs-2.0/ (assuming 2.0). Under that, you would have found a section titled "Environment Variables", and in a couple clicks you would have arrived at http://httpd.apache.org/docs-2.0/mod/mod_env.html#setenv which tells you what directive you want (the "how") to put in file httpd.conf (the "where"). > and what value is needed ? > local --> C:\thearter\cgi-bin\PTI\ > OR url --> http://localhost/cgi-bin/PTI/ You need the local, but I think you can use front slashes if you like. I _know_ Perl will take them, even in the -M qualifier. This question suggests a REALLY COOL enhancement: use url qw{http://somehost/perl_library/}; use Foo::Bar; # Gets fetched from the URL if it isn't found in @INC. Obviously, LWP gets loaded somewhere along the line. The funny thing is, it's not at all obvious to me that some variant of this can't be done. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Regular expressions in PERL vs VB.NET
Cameron Dorey <[EMAIL PROTECTED]> wrote: > Mangesh wrote: > > I am trying to use one regular expression to extract search result from > > Google. > > > > > > > > In PERL script this works fine but in VB.NET this does not work. any > > suggestions?? > > > [VB snipped] > No suggestions but the obvious one: use perl (not PERL). Or post the question to a VB mailing list. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How to find the process information ???
"sadanand limaye" <[EMAIL PROTECTED]> wrote: > I have written a perl script to find the program is running or not. > On Unix, I can use to test mytest binary is running > $isprocactive = `ps -ef | grep mytest | grep -v grep | grep -c mytest`; > If the process mytest is running then $isprocactive is set to 1. Similarly , > how can I test whether mytest is running on Windows ??? There Is More Than One Way To Do It 1) Install the resource kit for your version of the OS. Under NT (and friends, such as Win2K), the resource contains a program called "pulist", which is the Win32 version of "ps". There's no "grep", but I suspect there are better ways than invoking grep three times over anyway. One possibility: #!/usr/bin/perl $lookfor = shift @ARGV || 'WINLOGON.EXE'; $re = quotemeta $lookfor; $isactive = grep {m/^$re/io} `pulist`; print "$lookfor ", $isactive ? "is active\n" : "is not active\n"; __END__ 2) Install one of the Perl libraries that has this functionality. The list includes: * Win32::PerfLib (emphasis on performance counters. .xs module) * Win32::IProc (abandoned, but available from Jenda) * Win32::Process::Info (emphasis on "ps"-type info) * Win32API::ProcessStatus (emphasis on what .exe and .dll files used. .xs module) I don't believe ActiveState carries any of these, but all except Win32::IProc are available from CPAN. For Win32::IProc see http://jenda.krynicky.cz/ or the mirror at http://www24.brinkster.com/jenda/index.html The ".xs" modules require Visual C++ for installation. In addition, Win32API::ProcessStatus requires psapi.h Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: $_ = undef; # Creates 'modicication of read-only' error
Lee Goddard <[EMAIL PROTECTED]> wrote: > Here's a funny thing: I'm getting the runtime error "Modification of a > read-only value attempted" when $_ is set to any value (including undef). > This is the only $_ in the scope, and it doesn't matter where in the block > I put it. > First thing in a subroutine, no change. > $_ contains the literal value 'chat'. > This is weird, *isn't it*?! It may be weird, but it's the documented behaviour of the 'for' (and 'foreach') loops. As it says in the relevant section of 'perlsyn': If any element of LIST is an lvalue, you can modify it by modifying VAR inside the loop. Conversely, if any element of LIST is NOT an lvalue, any attempt to modify that element will fail. In other words, the foreach loop index variable is an implicit alias for each item in the list that you're looping over. A string literal is not an LVALUE (that is, you can't assign a value to a literal), so the assignment fails. See your ActivePerl HTML documentation, or do C:\>perldoc perlsyn The following one-liner demonstrates. C:\>perl -le "for (qw{Larry Moe Curley}) {print; $_ = lc $_; print;}" Larry Modification of a read-only value attempted at -e line 1. C:\> One way to get around this is to assign $_ to another variable, and operate on that: C:\>perl -le "for (qw{Larry Moe Curley}) {print; $x = lc $_; print $x;}" Larry larry Moe moe Curley curley C:\> Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Environment variables
"Mundell, R. \(Ronald\)" <[EMAIL PROTECTED]> wrote: > How do one set an Environment variable out of a perl script, let say PATH? $ENV{PATH} = But this only works for processes spawned by the Perl script that does the setting. Search the archives of the os-specific mailing lists for OS-specific solutions that _may_ get you a bit broader scope. Tom This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Search & Replace
Lee Clemmer <[EMAIL PROTECTED]> wrote: > s/$search/$newstr/i You might want to modify this to s/$search/$newstr/igo The "o" promises Perl you will never change the $search string. Perl will then put it through the regular expression compiler the first time it's encountered, and you _should_ perform a little better. The "g" covers the case where the search string occurs more than once per line. Another tweak would be to set $/ = undef; This puts Perl into "slurp" mode, and a single read reads all the data in the file. This has advantages and disadvantages. The advantage is that you have all the data internally, and don't have to write your output file unless something actually changed. The disadvantage is that you have all your data internally, and may have memory problems with big files. Tom Wyant Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Perl equivalent to VB's IsObject
I assume IsObject is a method that returns TRUE if the given object is of the given class, and FALSE otherwise. If this is the case, the 'canonical' way to do it is to use UNIVERSAL::isa. See the 'perlobj' documentation for details. Here's some (working, this time!) sample code: use strict; use warnings; package Foo; sub new { my $class = shift; my $self = {}; bless $self, $class; return $self; } package main; use UNIVERSAL qw{isa}; use FileHandle; @ARGV = ('UNIVERSAL', 'FileHandle') unless @ARGV; my $x = Foo->new (); foreach (@ARGV) { print "$x ", isa ($x, $_) ? "isa $_\n" : "is not a $_\n"; } __END__ Note that isa ($x, 'UNIVERSAL') is equivalent to 'is this a blessed reference (i.e. an object of any class whatsoever)', because UNIVERSAL is a superclass of all classes. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Puzzle of the Week
The code: while (<>) { $day = ''; print "Before: $_"; s/(Monday|Tuesday|Wednesday|Thursday|Friday| Saturday|Sunday)'s(\s+Games)?//x and $day = $1; print "After: $_"; print "Day = '$day'\n"; } The test: C:\>perl trw.tmp Yesterday's Games were boring Before: Yesterday's Games were boring After: Yesterday's Games were boring Day = '' Before Sunday's Games we partied Before: Before Sunday's Games we partied After: Before we partied Day = 'Sunday' After sunday's games we had hangover Before: After sunday's games we had hangover After: After sunday's games we had hangover Day = '' Monday we had to be at work Before: Monday we had to be at work After: Monday we had to be at work Day = '' Monday's work was no fun Before: Monday's work was no fun After: work was no fun Day = 'Monday' "Yesterday's Games were boring" was unaffected. "Before Sunday's Games we partied" had "Sunday's Games" stripped, and $day set to Sunday. "After sunday's games we had hangovers" was unaffected, because the match was case-sensitive. "Monday we had to be at work" was unaffected, because "Monday" had no apostrophe "Monday's work was no fun" had "Monday's" stripped, and $day set to Monday. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Question on sub/method call and context
Burak Gürsoy <[EMAIL PROTECTED]> wrote: > umm... did you read my message? > wantarray is 'exactly' what you want Second the motion. In fact, Last night I spent a little time writing a rebuttal, but then I tried it, and you're exactly right. I figured this would be the last word, but should have known better. In support of the correct position: C:\>perldoc -f wantarray wantarray Returns true if the context of the currently executing subroutine is looking for a list value. Returns false if the context is looking for a scalar. Returns the undefined value if the context is looking for no value (void context). return unless defined wantarray;# don't bother doing more my @a = complex_calculation(); return wantarray ? @a : "@a"; This function should have been named wantlist() instead. C:\> Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Excel to html format
[EMAIL PROTECTED] wrote: > The $expletive produced by Excel claiming to be HTML > is just awful (and Office 2000 is even worse) You got that right. When HTMLizing "Put the CD in the CD drive" with Word2K, we got "Put the CD in the CD drive." > If you do save from Excel, make sure you run the resulting file > through HTML Tidy. Definitely. If it will take it. Last time I tried the HTMLTidy embedded in HTML-Kit with Word2K-generated HTML, it died horribly. Maybe you need a more recent HTMLTidy than is embedded in HTML-Kit. Or use OpenOffice.org. Both word processor and spreadsheet produce better HTML than the corresponding MS-office products. Well, they actually _produce_ html (the MS ones do XML, as the humorous but apposite example above illustrates). Anyhow, for the same 5-row by 2-column spreadsheet, OpenOffice produced 50 lines of HTML, and Excel produced 150 lines of XML. But unfortunately I have no experience with OLE to OpenOffice. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Remove the Elements of Array A from Array B
"optique" <[EMAIL PROTECTED]> wrote: > forgive my poor english, :), I come form beijing, china. It is better than my Chinese! > my question is: > @B = (1,2,3,4,5,6); > @A = (3,6); > and I want to remove 3 and 6 from @B, after that the @B > will be (1,2,4,5). > but, I don't want to use "foreach" to iterate @B and @A > Is there any easy way to do this? If the numbers in @B are _not_ unique, you can do something like @B = (1,2,3,4,5,6); print "\@B = (@B)\n"; @A = (3,6); print "\@A = (@A)\n"; %remove = map {($_, 1)} @A; @B = grep {!$remove{$_}} @B; print "\@B - \@A = (@B)\n"; __END__ Of course, the 'map' and 'grep' both iterate over the lists, but this way avoids nested iterations. The sample puts the results back in @B because that is what you said you were doing. But you could put the output of the 'grep' in any list you like. If you want to do something more like the FAQ solution recommended by $Bill, pay attention to his note that the algorithm produces a _symmetric_ difference; that is, the output will also include all items in @A that are not in @B. There are none in this example, but there may be in your problem. Another solution which is a bit more like the "book" solution, but yet allows a true "@B - @A" goes like this: @B = (1,2,3,4,5,6); print "\@B = (@B)\n"; @A = (3,6); print "\@A = (@A)\n"; $bit = 1; $all = 0; foreach $list (\@A, \@B) { foreach $item (@$list) { $mask{$item} |= $bit; } $all |= $bit; $bit <<= 1; } print "Union: (@{[grep {$mask{$_}} keys %mask]})\n"; print "Intersection: (@{[grep {$mask{$_} == $all} keys %mask]})\n"; print "\@A - \@B: (@{[grep {$mask{$_} == 1} keys %mask]})\n"; print "\@B - \@A: (@{[grep {$mask{$_} == 2} keys %mask]})\n"; __END__ Because this solution iterates over the hash rather than over the lists, it loses the order of the elements. You could preserve order in everything but the intersection by feeding the appropriate list (rather than the keys of the hash) to the 'grep'. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: avtc.com test
All, My apologies to the list for the previous empty note. Starting about a day ago, everything I post to this list gets the following reply from System Attendant <[EMAIL PROTECTED]>: Trend SMEX Content Filter has detected sensitive content. Place = [EMAIL PROTECTED]; ; Sender = Thomas R Wyant_III Subject = Norton Antivirus vs. Perl [was RE: Failure in backticks] Delivery Time = October 31, 2002 (Thursday) 05:48:07 Policy = Dirty Words Action on this mail = Quarantine message Warning message from administrator: Sender, Content filter has detected a sensitive e-mail. Now, I will admit to being less than a paragon of political correctness, so at first I thought someone had declared some part of my vocabulary off-limits; for example, the first bounced message contained the word "massage." When the message about Norton Antivirus bounced, I began to suspect that the problem was the disclaimer my employer has started tacking on to the end of all my messages. So I sent an empty message to test. If avtc.com can find dirty words in an empty message, it must be the corporate disclaimer. Right? Or someone has decided that saying nothing is offensive. I thought I'd sit on this for a little before sending, and sure enough I got the above message from avtc.com's content filter in response to my empty message. Maybe I'll write their system administrator. No. Wait. That won't work. Ermmm... Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
avtc.com test
This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Norton Antivirus vs. Perl [was RE: Failure in backticks]
No problems with: Norton Antivirus Corporate 7.60.926 ActivePerl 633 Windows 2000 SP2 (5.00.2195) Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: SQLServer DBI Woes
Carter, I'm with Johan Lindstrom - bind variables are the way to go. If you're unfamiliar with them, they're a little strange at first. The following is your script cold-coded to use bind variables and placeholders. # Create the Insert my $SQL = <<"-- sql end --"; INSERT INTO scmrequests (Status, SubmittedBy, Email, Category, ShortDesc, LongDesc, Priority) VALUES ('NEW', ?, ?, ?, ?, ?, ?) -- sql end -- # Set PrintError and RaiseError. my %attr = ( PrintError => 1, RaiseError => 1 ); # Open a connection to the database or die. my $dbh = DBI->connect("DBI:ODBC:scmdata", "user", "password", \%attr) or die "Can't connect to DataBase: ", $DBI::errstr, "\n"; # Quote, prepare the SQL statement and then execute it. my $sth = $dbh->prepare($SQL); $sth->execute(map {$HASH{$_}} qw{name email category title ldesc priority}); If you were executing the statement more than once, you might want to use prepare_cached rather than prepare. You _may_ be suprised by the difference. Or you may not. But it's worth looking into. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Help using XML::Parser
Phil - You might want to look at XML::Simple. I get the impression XML::Parser is the foundation of a _lot_ of XML code (including XML::Simple). XML::Simple will load the XML into a data structure that looks a lot more like what you probably want to massage with Perl. It goes to considerable lengths to "normalize" the internal representation of XML, and you will find that they don't call it "data reduction" for nothing. The things that XML::Simple will lose for you include: * The top-level pair of tags (but you can configure it to keep them) * Text (or at least whitespace) which is not enclosed by the innermost set of tags (e.g. the newline and two spaces before the tag in your example. * The order of duplicate tags (e.g. multiple tags). * Some of its normalization obfuscates the difference between values and attributes. This is a feature, and is to a certain extent configurable. What I would recommend is write stub scripts to just load the XML, using both XML::Parser and XML::Simple. Use Data::Dumper to dump the output, see which output you like best, and go. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Problem with Date::Manip
[EMAIL PROTECTED] wrote: > The output looks like this: > date1 => 2002101714:59:00 > date2 => 2002102510:47:56 > date3 => +0:0:1:0:19:48:56 > There's defintely 7+ days between these two dates, it shows 0 days, > 19 hours, 48 minutes, 56 seconds. Actually, it shows 1 week, 0 days, 19 hours, 48 minutes, 46 seconds. If you read the Date::Manip docs, the example says: $delta=&DateCalc($date1,$date2,\$err); => 0:0:WK:DD:HH:MM:SS the weeks, days, hours, minutes, and seconds between the two Why is this the wrong answer? Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Can't access from Command Line
Burak - Unless, of course, the user opened first! :-) Perverse example: C:\>perl print "Hello, sailor!\n"; __END__ Hello, sailor! C:\>perl while () {print "Data> $_"} __END__ The bustard's a genial fowl Data> The bustard's a genial fowl with minimal reason to growl. Data> with minimal reason to growl. He escapes what would be Data> He escapes what would be Illegitimacy Data> Illegitimacy By means of a fortunate vowel. Data> By means of a fortunate vowel. ^Z C:\> Tom Wyant Burak Gürsoy <[EMAIL PROTECTED]>@listserv.ActiveState.com on 10/22/2002 02:56:08 PM Sent by:[EMAIL PROTECTED] To:"perl-win32-users" <[EMAIL PROTECTED]> cc: Subject:RE: Can't access from Command Line btw, if you write "__END__;" and enter, perl will exit :) -Original Message- From: [EMAIL PROTECTED] [mailto:perl-win32-users-admin@;listserv.ActiveState.com]On Behalf Of Tillman, James Sent: Tuesday, October 22, 2002 7:27 PM To: perl-win32-users Subject: RE: Can't access from Command Line >>When I go to the command prompt, I type >> >>C:\>perl >> >>and the computer just sits there. > Sounds normal to me...you didn't tell perl to do anything. > How fitting. The perl executible is as lazy as the programmers who love it so much! ;-) jpt ___ 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 This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::AdminMisc problems
Hari - You've got me. It seems to me if Win32::AdminMisc is installed on your server _and_ your browser has access to it, this shouldn't happen. But I've seen it come by on the mailing list. You might want to root around in the archives and see what comes up. Tom "Krishna, Hari" <[EMAIL PROTECTED]>@listserv.ActiveState.com on 10/10/2002 10:15:16 AM Sent by:[EMAIL PROTECTED] To:[EMAIL PROTECTED] cc: Subject:Win32::AdminMisc problems Hi Guys, I get the following error when I execute my perl script from the browser. But when I execute the program by double clicking, it works fine. Any guesses?? I see the result in the test.txt file "Password is correct" Heres' the code #! D:\Perl\bin\Perl.exe use strict; use Win32::AdminMisc; open(OUT_EXT,">test.txt"); $domain = "abcdefg"; $user = "confidential"; $password = "confidential"; if( Win32::AdminMisc::UserCheckPassword($domain, $user, $password)) { print OUT_EXT "Password is correct.\n"; } else { print OUT_EXT "Password is not correct.\n"; } Here's the error --- CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: Can't locate Win32/AdminMisc.pm in @INC (@INC contains: D:/Perl/lib D:/Perl/site/lib .) at D:\inetpub\wwwroot\Intranet\cgi-bin\xyz.pl line 2. BEGIN failed--compilation aborted at D:\inetpub\wwwroot\Intranet\cgi-bin\xyz.pl line 2. - Tom Wyant --- Many thanks for your help. Thanks and Regards, Hari CONFIDENTIALITY NOTICE: This e-mail message, including all attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. You may NOT use, disclose, copy or disseminate this information. If you are not the intended recipient, please contact the sender by reply e-mail immediately. Please destroy all copies of the original message and all attachments. Your cooperation is greatly appreciated. Columbus Regional Hospital 2400 East 17th Street Columbus, Indiana 47201 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32/Unix File differences
John Drabinowicz <[EMAIL PROTECTED]> wrote: > I just got the O'Reilly "Learning Perl on Win32 Systems" book and > have a question about using the directory/file structure. > This book says that I can walk the directory as shown is example 1, > [using <> globbing] but I have been using example 2 [which uses the > glob () function]. > Now I have Cygwin installed on my computer and was wondering if > example 2 works because of that, or if it just works on Win32 > systems. I'm trying to keep the code as generic as possable, and > would like the code to work on both platforms. examples removed The "glob" function works regardless of Cygwin. It's part of base Perl, though it _can_ be overridden (and I think typically is, by File::Glob, though you can use File::DosGlob if you like). "perldoc perlwin32" is my authority for this. > I hope I'm making some sense ;-> Am _I_ a judge of this? Your question makes perfect sense to me. You may be displaying a touch of paranoia, but frankly, I think The World Would Be A Better Place if more people had your particular brand of paranoia. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Calling WMI Methods with Win32::OLE
"Scott Campbell" <[EMAIL PROTECTED]> wrote: > I have looked everywhere to find an example of how to call a > "method" in WMI with perl, and have been unsuccessful. > Does anyone know if it can be done, and if so, have an example? Yes, it can be done. The following script lists all process IDs, and the SID of the user of each. The method call is $proc->GetOwnerSid ($sid) The Variant stuff is in there because that's the way this particular method is called. See the docs for the signatures. Note also that this method returns FALSE for success; this is why we extract the string from the variant "unless" the call returns TRUE. use Win32::OLE qw{in with}; use Win32::OLE::Const 'WMI'; # If needed use Win32::OLE::Variant; # If needed my $mach = shift @ARGV || ".";# Or whoever my $olecls = "winmgmts:{impersonationLevel=impersonate,(Debug)}!//$mach/root/cimv2"; my $wmi = Win32::OLE->GetObject ($olecls) or die "Error - Win32::Process::Info::WMI failed to get winmgs object from OLE: ", Win32::OLE->LastError; my $sid = Variant( VT_BYREF | VT_BSTR, ''); foreach my $proc (in $wmi->InstancesOf ('Win32_Process')) { my $oid = ''; $oid = $sid->Get () unless $proc->GetOwnerSid ($sid); print "$proc->{ProcessId}\t$oid\n"; } print "Done.\n"; Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::ODBC Question (Oracle)
[EMAIL PROTECTED] wrote: > I'm trying to get Information about a spezific table in an Oracle > with the command > 'describe table_name; ' > This command works within SQL-PLus and other Tools but I get the > error message: "Ora-00900: invalid SQL statement" when I use it > within a perl-script using a Win32::ODBC connection. > Does someone know a solution , maybe to use a DBD, DBI module or > a different statement to get information about the table definition? You don't say what information you want about the table. If you want to know what columns are in the table, and what data types are in the columns, you perform a select against the table, and then pull the data out of the selection results. If you don't want any data at this point, the usual dodge is to specify a "where" clause that is never satisfied. In fact, the usual dodge is select * from your_table where 1 = 0 I don't know of any better way under DBI, but you need to know less about your data types if you use DBI, because it supports placeholders. So instead of generating the entire text of a query, and worrying about whether values need to be quoted, and if so how to escape any embedded quotes, you just put a question mark in the query, and provide the value when the query is executed. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Setting the actual directory with a Perl script.
"Adam Ingerman" <[EMAIL PROTECTED]> wrote: > [[EMAIL PROTECTED] wrote:] >> do you know a possibility to set the actual directory inside a Perl >> script ("chdir my_dir;") to get it changed in the command shell >> outside the script? > easiest way, tell the shell to do it for you. if you're on windows, > #---code-- > system("cd c:\\windows\\"); > #-- snip Yes and no. The system command spawns a subprocess to do its dirty work. In the example given, the spawned subprocess changes its default directory as required, and then exits, leaving Perl's process unmodified. A Perl "chdir" will actually change the Perl script's default directory, as Adrian Stovall pointed out. But what the original writer called for was a way to change the default directory of the command shell that invoked Perl - under Win32 this means changing its parent process. I'd _love_, at this point, to smugly trot out the actual way to do this. But I don't know one. All I can tell you is that the following _do not_ work: system ("cd ...") `cd ...` chdir Win32::SetCwd Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Using Pack and Unpack
"Warkentin, Brad" <[EMAIL PROTECTED]> wrote: > Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] > postulates: >> Because of the "text" mode translation, DOSish perls have >> limitations in using "seek" and "tell" on a file accessed >> in "text" mode. > True, however I thought the limitation was that you could only > "seek" to locations provided by "tell". Given that the index is > generated using tell, seeking to the locations should work, > independant of the stupid \015\012 crap. That's correct. The example does a "tell" on the main file, and puts the results in the index. But then it computes "seek" values on the index. You could get around that by doing a "tell" every time you write the index, and keeping _them_ somewhere. Of course, if you keep them in a file (a meta-index), you rapidly disappear into an infinite regress. Tom This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Using Pack and Unpack
Paul Flint <[EMAIL PROTECTED]> wrote: > I'm getting incorrect results from recipe 8.8 in the Perl Cookbook. > I'm building an index of offset positions for lines in a file (3 > MB), which I'm supposed to be able to use to access any line in that > file. > I use Code A to build the index. (taken from Perl Cookbook, see > below) > But when I use Code B (see below) to access it, I get back random > results if accessing lines higher than 90 or so. > I think that the offset value becomes too big to store in a > pack("N", $offset) and the index creator starts kicking out > random numbers, which of course cause line_with_index to read > random lines of the file. > Does this sound correct? And if so, what can I do about it? A > friendly pointer to the correct documentation would help. I > can't seem to find it in my Web searches. "N" packs or unpacks an unsigned long, which according to ANSI "C" goes to 4 gig; it's hard for me to believe you can overrun this in a 3mb file. What I think I would try instead is to put the index file into binary mode. right after you open it (hint: binmode I; ). What I fear is going on is that somewhere along the line you generate a byte whose value is 0x10. If that happens under Windows 32 and you're not in "binmode", the "C" runtime will "expand" this to 0x13 0x10, and at that point, you're dead in the water. So am I saying that Tom Christiansen and Nathan Torkington are wrong and I'm right? Not really. I don't own a copy of this book, but I suspect you'll find somewhere in the front matter something about the target system being some flavor of Unix. U**x doesn't need the "binmode", because the "C" RTL doesn't mung the I/O streams. On most other systems, though, it gets munged to make the data stream look a unix-y as possible to your code. Under Windows, this means translating 0x10 (= ) to 0x13 0x10 (= ) on output, and the reverse on input. Other things happen under other operating systems. If you look in the "perlport" documentation (a.k.a. "Writing Portable Perl") you will see: Because of the "text" mode translation, DOSish perls have limitations in using "seek" and "tell" on a file accessed in "text" mode. ... If you use "binmode" on a file, however, you can usually "seek" and "tell" with arbitrary values in safety. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: NET::Telnet
Jitranda, I gave up trying to figure out what to use as a prompt for Net::Telnet when connecting to Windows' telnet server. Maybe someone out there will enlighten us both. Tom "Jitendra Soam" <[EMAIL PROTECTED]>@listserv.ActiveState.com on 09/17/2002 10:38:52 AM Sent by:[EMAIL PROTECTED] To:<[EMAIL PROTECTED]> cc: Subject:RE: NET::Telnet Thanks. But the what should be used as prompt? -Original Message----- From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 7:01 PM To: [EMAIL PROTECTED] Subject: Re: NET::Telnet "Jitendra Soam" <[EMAIL PROTECTED]> wrote: > Is it possible to use Net::Telnet module to telnet into Windows > machine running Microsoft Telnet Service.. In theory, yes, _provided_ the Telnet service is set up to do username/password authentication. This is not the default. In practice, there appear to be significant problems figuring out what you should tell it the prompt string is, because Microsoft embeds all sorts of escape sequences in it. > and start Any program like Notepad on target machine? In theory, yes. In practice, of course, Notepad displays on the target machine's desktop, which probably does you as the owner of the telnet link no good at all. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ 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 This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Debugging?
Beckett Richard-qswi266 <[EMAIL PROTECTED]> wrote: > Is there something I can insert into the script to stop the parser > from checking the rest of it, before execution? As Adrian Stovall, wrote, __END__ is useful in this duty, and in fact I have so used it. Sometimes, though, the part you want to defer until later is smack in the middle. In this case, you put =pod before the part you want the compiler to ignore, and =cut where you want the compiler to start paying attention again. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: creating links (*.lnk files)
Eckart - Aldo Calpini's Win32::Shortcut will both create and manipulate shortcuts. It comes with ActivePerl, but unfortunately, the documentation apparantly gets lost somewhere between him and ActiveState's distribution. You can get it by downloading the current Win32::Shortcut from http://dada.perl.it/. The docs are in the zip file, in HTML. Tom Wyant "ecki" <[EMAIL PROTECTED]>@listserv.ActiveState.com on 08/28/2002 04:27:24 PM Sent by:[EMAIL PROTECTED] To:<[EMAIL PROTECTED]> cc: Subject:creating links (*.lnk files) Hi all, is there a perl module to create *.lnk files (e.g. used in the 'Sent to' folder in order to send txt files to the notepad)? Or does anybody know the structure of these files? Thanks Eckart ___ 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: trying to understand how regex works
Ron Grabowski <[EMAIL PROTECTED]> wrote: > my $regex = join '|', 'value_garbage1', > 'value_garbage2', > 'value_garbage3'; > next if /$regex/; You might want to say "next if /$regex/o" to prevent Perl from compiling every time. If you're Perl 5.6, you could even make use of the sexy new qr {} operator, which returns a reference to a compiled regular expression: my $regex = join '|', ... my $re = qr{$regex}; next if /$re/; Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
ActiveState's Archive-Zip.zip doesn't (?!) support Windows
All - While investigating Randy Kobes' PPM::Make package, I discovered that the copy of Archive-Zip.zip http://www.activestate.com/PPMPackages/zips/6xx-builds-only/ supports only sun4-solaris-thread-multi and i686-linux-thread-multi. No Win32. If I use PPM to acquire the module directly (i.e.: PPM instaill Archive::Zip) it works fine under Windows 2000. I believe from previous traffic on this list that ActiveState's PPM archive is built "automagically" from CPAN. So who do I see to get this one module, last built in 2000, corrected? Thanks, Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Problem with =~
Dovalle Yankelovich <[EMAIL PROTECTED]> wrote: > I need to take some data from txt file and im looking for a > string within the text. > here part of the text: > tionDwsRx: Total allocated bytes (downstream) = 0, bits = 2, > I need the value after the first '=' What's wrong with my ($bytes, $bits) = $line =~ m/^tionDwsRx: Total allocated bytes \(downstream\) = (\d+), bits = (\d+),$/ or next; This brings out the number after "bytes (downstream) =" in $bytes, and the number after "bits =" in $bits, and avoids your "while" loop to reassemble the numbers from their pieces/parts. The "next" skips the rest of the loop (hope that's appropriate!) unless the line actually looks like your example. Note that this is a REALLY long line, and it will probably get wrapped by someone's mail software - but if you put it back together right, it _should_ work. Recommended reading: perlre and perlretut in your Perl help. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Windows PID
Ember Normand <[EMAIL PROTECTED]> wrote: > It seems that Active State has not implemented getppid. > Any hints on how I can get the PID that is in the Windows Task > Manager? If you have WMI available, you can get it that way; see Dave Roth's "Win32 Perl Scripting" for more information. I've been working on a library called Win32::ProcInfo, which will get this information out of WMI. The code would be something like use Win32::ProcInfo; my $pi = Win32::ProcInfo->new (); my ($me) = @{$pi->GetProcInfo ($$)}; print "My parent is $me->{ParentProcessId}\n"; Note that GetProcInfo returns a list of hashes, since it can return information on more than one process. Is this of interest? I consider it beta code (current release: 0.002), and it won't help you unless you have WMI available (i.e. you're running Windows 2000 (for sure), Windows ME (I think), or Windows XP (ditto)). The module itself works without WMI, but it can't figure out who its parent is. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Determining Default 'My Documents' folder path
Adam, Under Windows 2000 (and possibly other Win* operating systems), see $ENV{USERPROFILE}. If you need a complete pathname: C:\>perl -MFile::Spec -e "print File::Spec->catfile ($ENV{USERPROFILE}, 'My Documents')" C:\Documents and Settings\wyant\My Documents Beware of the space if you intend to pass this to the glob function under Windows. Tom Wyant "Adam Frielink" <[EMAIL PROTECTED]>@listserv.ActiveState.com on 05/30/2002 10:24:40 AM Sent by:[EMAIL PROTECTED] To:"Perl-Win32-Users \(E-mail\)" <[EMAIL PROTECTED]> cc: Subject:Determining Default 'My Documents' folder path I have been looking for a way to determine the path of the 'My Documents' folder for a PC. I assume this is a registry setting. I did a search for this through MY registry and the only potential references I can find refer to a shell32.dll,9227. I don't have a clue as to what that means. Is there any help someone can provide? ___ 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: Using qw(....) on data from database.
_I_ think you need @nums = split '\s+', $nums; If you do push @nums, qw{$nums}; the list ends up containing ('$nums'), because qw is _not_ "double-quotish". Tom Wyant <[EMAIL PROTECTED]>@listserv.ActiveState.com on 05/16/2002 12:14:51 PM Sent by:[EMAIL PROTECTED] To:[EMAIL PROTECTED] cc: Subject:Using qw() on data from database. I'm using. while(($nums) = $sth->fetchrow_array) { print $nums; } This will give me "01 02 03 04" I want to push this into an array. push @nums, $nums; But I want the result of @nums = qw(01 02 03 04); The same as: @nums = ('01', '02', '03', '04'); How do I get this? I have tried "and I know this is wrong" push qw(@nums), $nums; # This of course errors. I think you get what i'm trying to do. Thanks in advance. Allan ___ 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: Newbie book
Yes, but _I_ didn't have to write any of it. If we're going to talk about ALL the code necessary to run C:\>perl -pe "" newscript.pl I feel constrained to point out that I executed not only Perl itself but Windows. A _serious_ attempt to reduce the amount of code needed to do the job would probably attack it at that point. Volunteers? Tom [EMAIL PROTECTED]@listserv.ActiveState.com on 05/11/2002 12:19:38 PM Sent by:[EMAIL PROTECTED] To: cc:[EMAIL PROTECTED] Subject:RE: Newbie book On 10/05/2002 18:46:11 perl-win32-users-admin wrote: >> As an example of how "ignorant" I am of anything outside of windows, it >> took me quite a while to discover I should open my scripts in wordpad >> and NOT notepad (my highpriced web authoring tool ;-) > >Is this the line termination problem? Unix uses as the line >terminator, MS/DOS uses . So if you edit a Unix-format text file in >notepad, it all comes in (and out!) on one line. > >If this is what is happening, you can fix it by running the script files >through Perl. Try something like > >C:\>perl -pe "" newscript.pl > [snip] > >Note that with Perl, we achieved the file conversion using NO CODE >WHATSOEVER. How's THAT for efficiency? > Cheat. You used lots of code, first of all Perl. You even used Perl code. If you don't believe me, put -MO=Deparse on the commandline. You could've used the more fun (but slightly confusing) perl -perl oldfile >newfile :-) -- Csaba Ráduly, Software Engineer Sophos Anti-Virus email: [EMAIL PROTECTED]http://www.sophos.com US Support: +1 888 SOPHOS 9 UK Support: +44 1235 559933 ___ 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: How to make sequences
"Mary J Blige" <[EMAIL PROTECTED]> wrote: > Does anybody know the good algorithm [snipped code would be better > ;-)] that can produce all sequences of a string of numbers?? Sounds like you're talking about permutations. I searched CPAN (http://search.cpan.org/) with the word "permute" and came up with Algorithm::Permute and Algorithm::FastPermute. I didn't see any PPM versions of these on ActiveState. Technically you need some version of "make" (generally "nmake" under Wintel) to install a CPAN kit. But unless the one you pick needs a DLL, you can always try a "Drag-and-drop" installation. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: regex'ing for e-mail addresses
I had a wonderful example, but this message is too small to contain it. Rather than asking people to post again, have you tried the mailing list archive? Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: tk html help missing
"Tillman, James" <[EMAIL PROTECTED]> wrote: > Is anyone else less than thrilled regarding this new CHM version of > the help? I fail to see the benefit when it doesn't add newly > installed modules to the help. With the plain HTML help we used to > have in ActivePerl, new modules got added to the tree automagically. IM(NS)HO it's not a total washout, but CHM has definite drawbacks. I have both, having rooted out and installed the HTML help kit (which ActiveState did NOT make easy to find). When I'm looking for module documentation, and I know the module is in the core ActivePerl kit, I use CHM. For anything else I typically use HTML. I can search an individual page, I can add modules and get the docs, I can open in a separate window when the docs are complex enough that I need to fill a screen with them, and I can search a doc and have the hit actually displayed (instead of having to scroll down looking for highlighted words). There's no built-in search of the entire document tree, but there are other ways to do that. > Maybe I'm missing something obvious. Me too. We do get a full-docset search with the CHM version, but "full" in this case means ActivePerl distribution only (i.e. for sufficiently small values of "full.") I hesitate to complain too much about free software, but I feel that ActiveState has pulled several unsmooth moves lately. I'm at 630, and I plan to hunker down and stay that way at least until they work out the PPM problems. I'm not ready to call for dumping the CHM documentation, but I believe it would be good to include the HTML documentation in the core distribution, at least until they figure out how to add the docs for new modules to CHM. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Pattern Matching Help
Balam, You say your code is not working, but you don't say what's wrong. You could try Date::Manip. It may be overkill, of course, and you don't get a Perl date out of Parse_Date; you still need to run it through Unix_Date with the %s format qualifier. And I always seem to have to hold my tongue just right to get it to figure out what time zone I'm in. But it's very flexable, and can handle dates like "2 weeks ago friday". A much lighter-weight solution would be something like the following: #!/usr/bin/perl -l use Time::Local; foreach my $inp (@ARGV) { print "'$inp' is ", ($inp =~/\b(\d{1,2})-(\d{1,2})-(\d{4})\b/ && ($val = eval {timelocal (0, 0, 0, $1, $2 - 1, $3)})) ? scalar localtime $val : "in error"; } Note the change in the regular expression, particularly the change from (e.g.) "(\d){1,2}" to "(\d{1,2})" to pick up the actual date numbers correctly, and the "\b" assertion at beginning and end to prevent a match on (e.g.) "1-10-200". The "eval" around the "timelocal" is because it croaks on an invalid time. This is still not COMPLETELY clean - it will accept "31-02-2000", and interpret it as March 2. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::ProcInfo beta testers wanted (was "potential new module ...")
All, The problem of how to get info on another process comes up here from time to time. I had my own incentive to solve the problem (I needed a full path name, and couldn't get it from anywhere I had access to) so with a little help from my friends (including, but NOT limited to, Dave Roth, Jenda Krynicky, and the authors of CygWin), I did my own. It comes in two flavors (WMI and Windows NT), and it attempts to determine which will work (in that order). So it SHOULD work on any system with WMI, and any Windows NT system, whether or not you have WMI (e.g. NT 4.0 without the add-on). It's theoretically possible to extend this to Non-NT non-WMI systems (i.e. Win95 ...), but I haven't got access to such a system to work with. The interface is: my $pi = Win32::ProcInfo->new (); There are two optional arguments: server name (which will Croak unless it in fact uses the WMI interface), and the names of the interfaces to try (comma-separated list contining 'WMI' or 'NT'; by default it's "WMI,NT"). my @pids = $pi->ListPids (); returns all the process IDs in the system, including the "special" ones (like 0). You can pass a list of PIDs in, and it will return all the input pids which are currently present in the system. I can't think of a good use for this, but the GetProcInfo call works the same way, and when I wrote this part of the code I was bedeviled by the hobgoblin of the small mind. my @info = $pi->GetProcInfo (); Returns information on the desired processes (if you pass in PIDs) or on every process it can find (if not). The return is a list of hash references, one per process. Each hash contains whatever information I could figure out how to get (and this depends on whether you're using the NT or WMI variant, and in the former case which version of NT you're on). The keys are the WMI keys, even if the NT variant is used. So here are my terms: Anyone who wants to be a beta tester should write to me (NOT to the mailing list) and specify whether you want a CPAN-style kit or a ppm-style kit. The latter WILL install html help - unfortunately recent ActivePerls don't use this anymore, but you CAN download it separately. You will need Win32::ODBC and/or Win32::API. Both come with current ActivePerls, but Win32::API didn't always. In return, I promise nothing (I'm not getting paid to do this), but I will attempt to respond to questions and suggestions. Bugs will be fixed when I can. Suggestions for other ways to do the same thing can also be made. I tried Win32::PerfLib, but that doesn't (as nearly as I can tell) get you things like the full path name of the program that the process is executing. Win32::Process does all sorts of things to processes it creates, but I can't figure out how to have it latch onto a random process and do something with it. Win32::ProcInfo is partly redundant with both of these, simply because of the architecture (if I may use the word) of Windows. But if there's any way to do the _whole_ job with another package or combination of packages, I'd like to know. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Potential new module to get information on an arbitrary Win32 process
All, Periodically there's traffic on this list about how to get information about another NT process. I have needed some things along this line, including things I can't figure out how to get from Win32::PerfLib (the full pathname of the executable is what I was really interested in). So I have written (with assistance and advice from Dave Roth, Jenda Krynicky, and the authors of CygWin, among others) a module specifically to return process information. It requires either WMI or Windows NT. Is there interest? Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Question re: Perl and CGI script
"Andrew Wax" <[EMAIL PROTECTED]> wrote: > I have a perl script that runs fine when I run it standalone. It > basically reads a file from a network drive and writes output to > a network drive. When I call this from a the web page it fails. Are you running the Apache service under a username that has access to the network drive? Or are you running it as "system", which is the default? "System" processes have no access to the network, because they have no actual username associated, and so can't get authenticated. Check this in the network control panel, and change it if needed. If this doesn't work: * Trap and display your errors * Try it interactively under the account the server uses * Try using UNC names rather than drive letters. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: V5.6 not passing input parameters
[EMAIL PROTECTED] wrote: > If the script is started using "perl test2.pl a b c" it passes > args correctly but not when called bare at a command prompt, ie > "test2.pl a b c" Build 630 works for me under Win2K SP2. The symptoms say that the .PL file association is incorrect. From a folder window, go Tools -> Folder Options -> File Types Find PL and click "Advanced." Select the "Open" action and click "Edit ...". This should bring up a little window that names the action ("Open," suprise, suprise) and gives the application used to perform the action. What you should see is something like "C:\Perl\bin\perl.exe" "%1" %* Given your symptoms, it sounds like the "%*" is missing off the end. Of course, this means the actual problem is that Windows is not passing the parameters. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE Connection error
See response to "Win32::OLE in Windows NT only" Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE in Windows NT only
Why do I get "Can't call method on an undefined value?" --- Because you're trying to call a method on an undefined value. This generally means that you did something like $object = Class->new (); $object->method (); and Class->new failed. The message is an alert that you should do some error checking: $object = Class->new () or die "Failed to create object."; $object->method (); The next question is why it failed. Different packages return errors differently. If $!, $@, and $^E don't contain anything interesting, read the module documentation to see if it defines its own error reporting mechanism (Win32 modules frequently do, and some other modules do also). If it didn't come with any, read the module. The situation might not be as clear-cut if you are "chaining" method calls (i.e. - $object->method->method), but the principal is the same. If you can't sort it out, the best way to proceed is probably to break apart such calls, and check for errors at every available opportunity. [the above is general. In your case, check for errors AFTER EVERY OLE CALL (both "new"s and both "open"s. See the OLE documentation for how to find out what error OLE encountered. Tom Wyant] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How do i unsubscribe this list
"karthikeyan" <[EMAIL PROTECTED]> wrote: > I have allready sent unsubscribe message before. This is one of those times when I think this mailing list needs a FAQ. I actually started one not too long ago, but most of the entries were "read the documentation," so I desisted. The following is from that document: How can I unsubscribe from this mailing list? - Go to http://listserv.activestate.com/mailman/mysubs, enter the address at which you receive the mailings, and hit the "View Subscriptions" button. Uncheck the check box opposite your subscription, and click the "Submit Changes" at the bottom of the screen. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Repost: problems with elsif and $self
<[EMAIL PROTECTED]> wrote: > Problem 1: > if/elsif fails. The first if stmt evaluates to false, but then the > subsequent elsif stmts are never tested, ... C:\1Tmp>type foo.pl if (0) { print "FALSE is TRUE!\n"; } elsif { print "FALSE is FALSE.\n"; } C:\1Tmp>perl foo.pl syntax error at foo.pl line 4, near "elsif {" Execution of foo.pl aborted due to compilation errors. Of course the elsif is never tested, because your code does not compile. I second the motion to repost with real code. > Problem 2: > I have a fairly large class which has a number of subs in it. I have > a global buffer $self->{BUFFER} which contains data I am munging. > When a subroutine calls another subroutine, the buffer becomes empty. > $self->{BUFFER} is undef after the call. I can confirm this via a > debugger as well as via print stmts. > Has anyone run into this before? Again, no. Every time I have thought something like this was happening, it has turned out that I wasn't using the variable I thought I was. Does "a subroutine" make an o-o call to "another subroutine?" If not, you'll get behaviour like this. Try displaying "$self" before and after the call, to prove you're using the same object. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: path info
<[EMAIL PROTECTED]> wrote: > I'm looking for a simple one or two liner snippet > that i can call to get the current directory of the script use Cwd; Example: C:\1Tmp>perl -MCwd -e "print getcwd" C:/1Tmp Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Ending a Program
All, I had a note from David Deline that supplied the missing piece. The corrected scripts are appended. The changes are: The script that generates the output needs to set $| = 1. This gets you automatic flushing of the output data. This means, by the way, that unless you can coerce the program you're spawning to do a similar thing, you won't get your output until it decides to do a buffer flush. The script that reads the output needs to shut down the subprocess when it hits the magic line of output. "die" by itself is not enough. # Counter.pl $| = 1; # <<< The new line $lim = shift @ARGV || 10; open OUT, ">counter.dat" or die "Failed to open output file: $!"; for ($i = 0; $i < $lim; $i++) { print OUT "$i\n"; print "$i\n"; sleep 1; } # Monitor.pl $stop = shift @ARGV || 2; $lim = shift @ARGV; $pid = open PIPE, "perl counter.pl $lim|" or die "Can't open process. $!\n"; while () { print; ##die "limit reached.\n" if $_ == $stop; next unless $_ == $stop; kill 'KILL', $pid or die "Can't kill $pid: $!"; # << The uncommented line close PIPE; die "limit reached.\n"; } Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Cobol Data conversion using Perl
Ah-Hah! It's all characters. "PIC XX" means a two-byte field, "PIC X(70)" means a 70-byte field. All you need is something like ($l_name, $f_name, $id1_num ...) = unpack 'A35A30A10...' where the elipsis ("...") means "you fill in the rest." Now figuring out what file to read and how to read it is another problem. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: matching filename with special characters
[EMAIL PROTECTED] wrote: > It seems that the ++ [in a regular expression] causes > problems (which I understand). Is there a way to tell > Perl to handle the ++ as a string rather than an operator? Yes. Oh. You want to know how? If you read "perlre" in the documentation which came with ActivePerl, it will tell you that the backslash ("\", and don't get me started on whether "\" or "/" is the backslash character) escapes a metacharacter, turning it into a plain character. The "perlfunc" documentation will tell you that the "quotemeta" function quotes ALL metacharacters. So yes, you can run your filename through that. But if you're rummaging through arbitrary HTML, you may want to read up on HTML::Parser, which is documented in (you guessed it!) the ActivePerl documentation. After all, the tag may look like If you don't want to learn a package just yet, there's a way to make a regular expression case-insensitive. I'd say what it is, but I'd REALLY like to encourage the reading of "perlre". If you get lost in it, try "perlretut", which is the tutorial. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Q: How to sort Array of Hashes
"Morse, Richard E." <[EMAIL PROTECTED]> > Orcish manouver? Not sure where I got that name for it. It's NOT in ActivePerl's HTML help (and I _did_ find it and install it over top of 630, since I add modules to ActiveState's kit, and I wanted the help for them available). It's a cacheing technique, so called because you do a Perl "logical or" to populate the cache ("or", "cache" - get it? *Groan*). Sample, from a Perl script that analyses the output of the MULTINET SHOW/CONNECTIONS command under VMS: use Net::hostent; # Beginning of a loop that, among other things, comes up with a dotted quad # IP address, and puts it in $rmtnod. The name lookup is slow, so ... $rmtame = $nodnam{$rmtnod} ||= lc (gethost ($rmtnod)->name) || $rmtnod; # The "||=" construction is characteristic of the Orcish maneuver. # End of loop, and of code snippet. The deal is that if $nodnam{$rmtnod} exists, nothing to the right of the " ||=" gets executed, and you retrieve the name right out of the hash. On the other hand, if $nodnam{$rmtnod} doesn't exist, the stuff to the right DOES get evaluated, the hash gets populated, and the name returned all in one fell swoop. More concise than unless ($nodnam{$rmtnod}) { $nodnam{$rmtnod} = lc (gethost ($rmtnod)->name) || $rmtnod; } $rmtname = $nodnam{$rmtnod}; Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Win32::OLE question
"Tillman, James" <[EMAIL PROTECTED]> wrote: > use Win32::OLE; > my $ServObj = Win32::OLE::GetObject("IIS://MYWEBSERVER/w3svc/1/Root"); Interesting. With ActivePerl 630, use Win32::OLE; my $ServObj = Win32::OLE::GetObject("IIS://MYWEBSERVER/w3svc/1/Root") or die Win32::OLE->LastError (); gets me "Usage: Win32::OLE->GetObject(PATHNAME[,DESTROY]) at trw.pl line 2." use Win32::OLE; my $ServObj = Win32::OLE->GetObject("IIS://MYWEBSERVER/w3svc/1/Root") or die Win32::OLE->LastError (); gets me 'Win32::OLE(0.1502) error 0x800401e4: "Invalid syntax" after character 0 in "IIS://SPRS21/w3svc/1/Root" at trw.pl line 2.' Actually providing the destructor gets me no object but no error. Okay, _which_ foot do I need to stand on when doing this? ;-) Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: Q: How to sort Array of Hashes
<[EMAIL PROTECTED]> wrote > Do you think we can impose upon our Original Poster to run some > benchmarking on his live data? Honestly, no. We could try, but since we're just mailing addresses to each other, I doubt we have anything to impose _with_. But if he wishes to do it and publish, I for one would welcome the information. My personal approach to just about any code is to do it the dumb way first, and tweak it if it isn't up to snuff. There are people who, no matter how many cycles they have at their disposal, grudge every one. But I figure that these days wetware cycles are generally more expensive than hardware cycles. Some benchmark data would tell us where spending a few wetware cycles is worthwhile. I have yet to use the Schwartzian transform, I merely pulled it in for completeness in my answer. The REALLY short answer to the Original Poster's question was "RTFM". But I wanted to couch this in the more humane terms of "Here's how you get started, and here's where you go for more information", and the Schwartzian transform was my hook for the second half. If only I could have found a way to bring in the Orcish maneuver, which I _do_ use, and which has a _much_ cooler name. Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: Q: How to sort Array of Hashes
"John Draper" <[EMAIL PROTECTED]> wrote: > I would like to sort @A_of_H based on 'SIZE', i.e., > A_of_H[$i]{'SIZE'} from largest to smallest. sort {$b->{SIZE} <=> $a->{SIZE}} @A_of_H is, strictly speaking, the answer to your question. However, I have no idea what will happen if two files have the same size. The canonical way to avoid this is to do something like sort {$b->{SIZE} <=> $a->{SIZE} || $a->{FILE} cmp $b->{FILE}} @A_of_H to get filename within filesize. Note the use of the arithmetic comparison operator on SIZE, and the string operator on FILE. This operation won't be real efficient. If this is a problem, look up the Schwartzian transform in PerlFAQ4 (Data Manipulation) which came with your Perl distribution. It will be under the item "How do I sort an array by (anything)." Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: problem with eval
"thiyag" <[EMAIL PROTECTED]> > i have a file with perl statments,I want them to be access few line > (depends dynamically) in my programe , > can anyone suggest me how to go about with it...! i tried reading the > file line by line extracting the needed line's into an array and then > executing each element with eval ( )...but it did't work . There's no reason this won't work, but you you may have to be careful about several things, such as the scoping of variables. You may find that concatenating the list into a string and "eval"-ing that produces better results. You should also check $@ after each "eval"; if your code fails to compile this is the only way you will know. Here's a short working script. Note the games played with backslashes to get the code into the list correctly. This would presumably not be a problem if the script was being read from a file. @ARGV = qw{Hello World!} unless @ARGV; my @stuff = ( "\$foo = join ' ', \@ARGV;", "print qq{\$foo\\n};", ); print "Foreach -\n"; foreach (@stuff) {eval $_; die $@ if $@;} print "Eval array\n"; print eval @stuff; die $@ if $@; print "Eval string\n"; eval "@stuff"; die $@ if $@; Here's the output: C:\>perl trw.pl Foreach - Hello World! Eval array Eval string Hello World! Iterating over the list works, but be aware that it would print a blank line if the first line was "my $foo = ..." rather than just "$foo = ...". The second produces no output, because "eval" supplies scalar context, so that it's equivalent to "eval 2" (since there are two elements in the list). The third should work as expected even in the presence of "my" variables, since they all get evaluated in the same scope. I will leave it to others to discuss the merits of "@stuff" versus join ' ', @stuff Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
Re: modifying (splitting) elements of an array
Abner, Daniel" <[EMAIL PROTECTED]> wrote: > What's an efficient way of splitting the elements of an array > globally? For instance, let say an array consists of the > following two elements: > Bob:Jones > Mary:Parker > Let's say I'd like to cut each element of the array down to > the string preceding the ":" colon. You mean, like my @names = qw{Bob:Jones Mary:Parker}; my @first = map {m/^([^:]*)/} @names; Tom Wyant ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users