Re: win32 issue
Timothy Johnson wrote: I don’t think this is enough information. * What is the value of $wordfile? * I’m assuming you’re trying to launch an instance of Microsoft Word. Is it installed on both systems? * What is your permission level on the systems? * What is the value of $^E? *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Rahul Shah *Sent:* Tuesday, April 25, 2006 6:57 PM *To:* perl-win32-users@listserv.ActiveState.com *Subject:* win32 issue when i run the command my $document = Win32::OLE-GetObject($wordfile) or die Cannot create object \n; it works fine for 1 host but on other host i get error: Win32::OLE( 0.1502) error 0x80070005: Access is denied at Like Tim says, more info would be good. Meantime, as the error clearly is not coming from your die... call but from Win32, you would likely get a more verbose error output by adding: $Win32::OLE::Warn = 3; ...after 'use Win32::OLE;' - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: TK question
Spencer_Lists wrote: Greetings perl-win32-users, This is really a TK question but I can't find a way to join the TK list in order to post. It does not show up in the subscriptions list. I have a TK Canvas on which I have drawn 128 polygons representing the extended MIDI piano keyboard. I have tried everything I can think of, consulting the documentation etc but I can not figure out a way to tell which polygon the mouse cursor has entered. Using TK widget, I only get a reference to the Canvas itself and not the individual polygon. Nothing else I have tried has worked either. my $poly0 = $c-createPolygon($NSt + $xadd,$top, $NSt + $xadd,$bot, $NSt + $NSp + $xadd,$bot, $NSt + $NSp + $xadd,$mid, $SSt +$xadd,$mid, $SSt + $xadd,$top, -outline= 'black', -fill= 'white', -tags= 'note0'); $c - bind($c -$poly0, ButtonPress-1, sub {send_note_on (0)}); $c - - bind($poly0, ButtonRelease-1, sub {send_note_off (0)}); You're binding to the poly object, not to the poly identified by the *tag*. Hopefully this snippet from working script will help clarify. foreach my $entity(qw /bodyshape pin1shape pin2shape/) { ... $poly{board} = $c-createPolygon($poly{profileArgs}, -outline = 'red', -fill = '', -tags = [$entity]); ... $c-bind($entity, '1', sub { #print ENT = $entity\n; ... }) ; } - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::OLE and Acroread anybody?
Greetings, Wondering if anyone has had any success controlling Adobe Acroreader thru OLE. There appears to be limited functionality exposed, as seen in OLE browser, but I didn't get past the first hurdle $acroApp = Win32::OLE-new('???'); Any clue most welcome. TIA - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE and Acroread anybody?
From: Kevin Carothers Hi Lynn, I haven't personally done this- but I've had some luck with Win32::OLE. Try $acroApp = Win32::OLE-new(AcroExch.App); $acroDoc = Win32::OLE-new(AcroExch.PDDoc); HTH- Thanks - though the first is indicated valid in acrord32.dll these and anything else I tried thus far, return Invalid class string I'm starting to think Adobe have crippled the Reader API. Maybe time to try working with SendKeys... :-( On 1/16/06, LYNN. RICKARDS [LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Greetings, Wondering if anyone has had any success controlling Adobe Acroreader thru OLE. There appears to be limited functionality exposed, as seen in OLE browser, but I didn't get past the first hurdle $acroApp = Win32::OLE-new('???'); Any clue most welcome. TIA - Lynn. ___ Perl-Win32-Users mailing list [LINK: mailto:[EMAIL PROTECTED] Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: [LINK: http://listserv.ActiveState.com/mailman/mysubs] http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [LINK: [EMAIL PROTECTED] Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: [LINK: http://listserv.ActiveState.com/mailman/mysubs] http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE and Acroread anybody?
Kevin Carothers wrote: Hi Lynn, What specifically are you trying to automate? Maybe I can try and help you find something (no promises, tho :-) KC Thanks for the thought - the aim is to open a document and either navigate to a known page or run a search. Useful-looking methods look to be exposed, I thought... I just came across the Acrobat module under wxPerl/ActiveX which looks hopeful, unless you or anyone have alternative suggestions. [OT] Paper books are far superior to PDF - I can bookmark any page I choose, without having to pay extra for special paper with foldable corners... From: Kevin Carothers Hi Lynn, I haven't personally done this- but I've had some luck with Win32::OLE. Try $acroApp = Win32::OLE-new(AcroExch.App ); $acroDoc = Win32::OLE-new(AcroExch.PDDoc); HTH- Thanks - though the first is indicated valid in acrord32.dll these and anything else I tried thus far, return Invalid class string I'm starting to think Adobe have crippled the Reader API. Maybe time to try working with SendKeys... :-( On 1/16/06, LYNN. RICKARDS [LINK: mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Greetings, Wondering if anyone has had any success controlling Adobe Acroreader thru OLE. There appears to be limited functionality exposed, as seen in OLE browser, but I didn't get past the first hurdle $acroApp = Win32::OLE-new('???'); Any clue most welcome. TIA - Lynn. ___ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: converting from Row, Column to Cell Name, and back, in Excel
From: Glen Plantz [EMAIL PROTECTED] Hi Folks, Could someone tell me how to convert from the Row, Column ( 1,1) reference to a Cell to using the Cell Name ( A1) ? I know this is an FAQ, but I can't seem to find an answer. Thanks for the help. Glen Plantz From the docs - eg http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.15/lib/Spreadsheet/WriteExcel.pm#Cell_notation Probably the answers you are looking for are in the examples that come with the package from CPAN (missing from the AS ppm) A couple of lines from convertA1.pl: print Cell B7 is equivalent to (; print join , cell_to_rowcol('B7'); print ) in row column notation.\n; but...apparently superceded by subs in Spreadsheet::WriteExcel::Utility. See the doc: C:\Perl\html\site\lib\Spreadsheet\WriteExcel\Utility.pm HTH - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32, Excel CommandButtons, picture=bitblt
Greetings, Finally figured that CommandButtons don't take an image filename but need the bitblt thingy available from LoadPicture in stdole.tlb library. Eg: my $cellHeight = 12.75; #Standard cell my $NewButton = $workSheet-OLEObjects-Add(Forms.CommandButton.1); # Can set a bunch of properties like so (Not that one would want them all): $NewButton-Select; $NewButton-{Left} = 0; $NewButton-{Object}-{Shadow} = 1; $NewButton-{Object}-{MousePointer} = 9; $NewButton-{Top} = ($cellHeight * 4); $NewButton-{Object}-{Caption} = MyButton; $NewButton-{Object}-{Name} = MyButton; # Here's the tough one... $NewButton-{Object}-{Picture} = $image; # How to get bitBlt $image? Have messed around with Win32::Gui::Bitmap* Win32::API and now am really hoping someone might have done this before, or at least help set me in the right direction.. TIA - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: uninitialized value in numeric gt ???
Michael D Schleif wrote: Happy New Year! I just installed spamassassin 3.1.0 (2005-09-13) on a debian box. Everything appears to be running OK, except these incessant errors: Use of uninitialized value in numeric gt() at /usr/lib/perl/5.8/DB_File.pm line 271. I have googled to no avail. Probably, there is something simple to be done; but, I have not found it, yet. So, I place myself at your mercy. ALL pointers are welcome. What do you think? P.S., $VERSION = 1.811 ; Others may have better answers, but... Aside from that perhaps a win32 list probably isn't thee best place to get even a perl problem fixed on Debian, my own experience with the out-of-box Debian perl build was that it generated too many errors. I uninstalled and replaced it with the Activestate-built RPM. Solved most of my problems, maybe yours... http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl HTH - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::OLE to write macro to Excel workbook?
Jan Dubois wrote: On Fri, 30 Dec 2005, Lynn. Rickards wrote: Thanks - that's a whole lot of steps in the right direction, but brings up the question what is perlCOM? I have the PDK but no sign there, and all the refs seem to indicate that is where it should be. PerlCOM used to be part of the PDK but has been removed in PDK 5, I think. It was never ported to Perl 5.8. You can create a control yourself with PerlCtrl that does most everything that PerlCOM did. Aha! ummm...any docs on this aspect of perlctrl in particular? Set PerlCOM = CreateObject(PerlCOM.Script) throws an activex error, cannot create object. The few other perl references I found, indicate this should work? The PerlCOM part should be irrelevant to your current problem. It is used in the sample to call from VBA into Perl. I understand you just want to add a VBA script to an Excel spreadsheet, but the VBA code doesn't need to execute arbitrary Perl code. The sample did show how to use the VBA object model to add a code component. Agreed...and I'm slowly getting where I want to be thanks to the example. The perlCOM just looked like a really neat-o way to replace VB with perl. Don't I recall a recent unsolved thread on that question? - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Why do they insist on making PPM so difficult to troubleshoot ??
Sisyphus wrote: Hi, D:\pscrptppm install DBI PPM::PPD::init: not a PPD and not a file: Ok ... something funny is happening here. First thing I'd like to do is take a look at the PPD file. Where is it ? More importantly, where is the documentation that enables me to find its location ? That route quickly turns into a blind alley ... let's try another way. How about I configure things so that the temp (build) directory doesn't get cleaned up. That used to be trivial to do with 'ppm set clean 0'. How do we do it now ? More importantly, where is the documentation that tells me how to do it ? Now, I don't know if either of those approaches would have helped. Thing is, it would have taken me only 5 minutes to determine, if I could have found out how to do those things - instead of the hour I've spent and got nowhere. So ... if someone can tell me where this information is to be found I will attempt to bookmark it for future reference. Cheers, Rob http://ppm.activestate.com/PPMPackages/zips ? hth - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
What's up with AS ppm repository? (was - Why do they insist on making PPM so difficult to troubleshoot ??)
Lynn. Rickards wrote: Sisyphus wrote: Hi, D:\pscrptppm install DBI PPM::PPD::init: not a PPD and not a file: Ok ... something funny is happening here. First thing I'd like to do is take a look at the PPD file. Where is it ? More importantly, where is the documentation that enables me to find its location ? snip Strangely, I get the same problem today - cannot ppm install anything from AS repository. After installing XML::SAX yesterday, the pureperl component did cause ppm to generate a bunch of warnings, so uninstalled but without effect. Finally just uninstalled perl altogether, deleted c:/perl and reinstalled clean. AS repository still returns the same error. http://theoryx5.uwinnipeg.ca repository works fine, and ppm *will* install downloaded zip packages locally from http://ppm.activestate.com/PPMPackages/zips/ VPM just dies on attempting install. Anybody else confirm? - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: [aswin32] Re: How to disable a control without changing appearance
Chris Rogers wrote: Sorry, about the lack of information in my original post. I just assumed, this being a perl-win32 group that Win32::GUI was a given. I'll try to be more specific in the future. I tried $control-Enable(0) but the control still gets greyed out. I'm using activestate perl 5.8.7 and Win32::GUI 1.03 on win xp. Here's a brief example: #!c:\perl58\bin\wperl.exe -W use strict; use Win32::GUI; use Win32::API; our $mainform = Win32::GUI::Window-new( -name='main', -text='main', -width=800,-height=600, ) or die window creation failed: $!\n; our $test = $mainform-AddTextfield( -name='test', -text='test', -left=200,-top=200, -width=100,-height=20, ); $test-Enable(0); $mainform-Show(); Win32::GUI::Dialog; I also tried to set the onClick event to an empty sub which didn't work either our $test = $mainform-AddTextfield( -name='test', -text='test', -left=200,-top=200, -width=100,-height=20, -onClick=sub{}, ); On 12/18/05, *Robert May* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Lynn. Rickards wrote: Chris Rogers wrote: I'm looking for a way to disable a control (widget) without changing it's appearance. I would like to be able to do this for any type of control. Any help would be greatly appreciated. Thanks, Chris Tk? Win32? Either way, what comes to mind instead of disabling, is configuring/binding to an empty sub. For Win32::GUI use $control-Enable(0); Regards, Rob. OK, I'm no Win32::Gui expert, and by the way, Tk is part of the ASperl distro, while Win32::Gui isn't...but don't let's fight over which should be the default assumption in the list ;-) I had assumed you were looking to render a button-based widget inactive. Since it is a text widget that (in win32-gui) doesn't seem to respond to mouseclick events, we need to handle it differently. Since calling $textbox-Enable(); and $textbox-Disable(); changes the colors, you would want to fix the colors. I find that adding: -background = [255, 255, 255], ...to AddTextfield() will hold the background white in both states. However, -foreground is overridden when the widget is disabled, and text is slightly grayed. I failed to find anything like Tk's $widget-configure() in the win32-gui docs - anyone? Half an answer, anyhow... HTH - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How to disable a control without changing appearance
Chris Rogers wrote: I'm looking for a way to disable a control (widget) without changing it's appearance. I would like to be able to do this for any type of control. Any help would be greatly appreciated. Thanks, Chris Tk? Win32? Either way, what comes to mind instead of disabling, is configuring/binding to an empty sub. HTH - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: List of Packages Supplied with ActivePerl Vx.y.z?
Randy Kobes wrote: On Thu, 10 Nov 2005, Veli-Pekka Tätilä wrote: Hi, A quick and simple question: How can I tell which packages are supplied with a given Active State Perl release? I've often been wondering this when distributing some of my own scripts to other people running Windows. Provided that there are missing packages, I can then list the ppm commands that should be used to get the necessary modules prior to running. However if no packages are needed, that means less downloading and things are somewhat easier to set up, too. So far, I've usually just rummaged through the package docs in my current Active State release, 5.8.6, in an attempt to figure out by date which ones I've upgraded or added with PPM. However, this method seems sort of unwieldy and might not apply to newer or older releases such as the new 5.8.7. I reckon there must be a list of these packages on a per version basis somewhere. But I just cannot seem to find it, oh well. One way might be to have the person list his or her package directory with the tree command in a DOS Box. But this is still a manual method and requires a bit of hand holding, if the person at the other end has never used a command-line before. I'm not sure how general this is, but for ActivePerl 8xx, there's a file, C:\Perl\site\lib\ppm-conf\ppm.cfg, which has a list of packages marked bundled that seems to contain a list of packages included with the installed ActivePerl distribution. This is above those coming with the core Perl modules - for those, one can use Module::CoreList: http://cpan.uwinnipeg.ca/dist/Module-CoreList to see what modules shipped with which version of Perl. For ActivePerl 6xx, the equivalent information to ppm.cfg seems to be contained in the file C:\Perl\site\lib\ppm.xml. Maybe check on http://ppm.activestate.com/ where available modules are listed, along with AS bundled modules. HTH - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Can a variable be made like this?
No... you [don't really] want perl -e $x='hello';${$x}='Check this';print $hello; YOU WOULD BE BETTER TO USE A HASH... Why do you need this [very unsafe] construct? Kind regards, Mark Anderson SMS Deployment Good advice. #!perl -w use strict; my %greeting; $greeting{salutation} = hi; $greeting{welcome} = how are doing you sir; print $greeting{salutation} . . $greeting{welcome} . \n; - Lynn. -Original Message- From: Kenneth Lodahl (KELO, ITRC, SH) [SMTP:[EMAIL PROTECTED] Sent: Wednesday, March 24, 2004 1:45 PM To: [EMAIL PROTECTED] Subject:Can a variable be made like this? *** WARNING : This message originates from the Internet *** $heygoodday = how are doing you sir; $hi = $hey; $hello = $hi.goodday; Print $hello; And get the output from $heygoodday? Is this possible in perl? I need it because I now the last piece of the variable name goodday, And the first piece that I need to get from the db. So that could be different. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Windows not passing args. in @ARGV - why not???
I need some help with a dumb problem I've got: For some reason, arguments from the Windows cmd.exe command line are no longer being passed into my Perl scripts via @ARGV. Used to work fine. I tried removing Perl. Reinstalled (ActiveState) Perl (5.8.3.809-MSWin32-x86.msi) (on XP). No help! Anyone have any ideas? -Colin You mean this doesn't work? Or you're doing something different? ---aa.pl-- #!perl -w use strict; unless(@ARGV) { print No args\n; exit 0; } for(my $c = 0; $c @ARGV; $c++) { print Arg . $c . = . $ARGV[$c] . \n; } - D:\testperl aa.pl No args D:\testperl aa.pl one two three Arg 0 = one Arg 1 = two Arg 2 = three D:\test - Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32::FileOp - BrowseForFolder
Hi all, I'm using the function BrowseForFolder from the Win32::FileOp module. Is there a possibility to use a root folder that is not a CSIDL_... constant (e.g. like c:/perl/site/lib or so)? The user of my application has to browse for a folder multiple times. If he always has to click his way through a (possibly deep) tree, he will be rather annoyed.. Thanks for any help! Regards, Gerhard AFAIK - no. However there's another BrowseForFolder with Win32::GUI which does have this option and others. See: http://search.cpan.org/src/ACALPINI/Win32-GUI-0.0.558/docs/methods.html#BrowseForFolder_OPTIONS_ -Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl and delphi interaction query.
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Beckett Richard-qswi266 Sent: Tuesday, February 10, 2004 12:13 PM To: '[EMAIL PROTECTED]' Subject: Perl and delphi interaction query. Guys, I inherited a delphi GUI, which is too complicated to even consider re-writing. So, I added a button that fires of a perl .exe, made with perlapp. The perl .exe works perfectly when run alone. It uses Tk and a ROText widget to display the progress of the script, and I changed the Tk icon in the corner to my own, like this... my $mw = MainWindow - new (-title =$title $version); $mw - withdraw; $mw - minsize (qw(600 400)); my $status = $mw - ROText()-pack(-expand, 1, -fill, 'both'); my $button = $mw - Button ( -text , 'Cancel', -command, \finished, ) - pack (-side, 'bottom'); my $icon = $mw-Photo(-file = 'SpikeWare.gif'); $mw-idletasks; $mw-iconimage($icon); $mw - Popup; $mw - focus; However, when I run this by clicking on the button from the delphi created gui, the script just dies. If I then remove the 3 lines that change the icon: my $icon = $mw-Photo(-file = 'SpikeWare.gif'); $mw-idletasks; $mw-iconimage($icon); - this seems to be the main culprit. Can't help with delphi but in view of your analysis try using a .xpm image, which can be included in your script like so... $mw-Pixmap( 'myicon', -data = loadIcon()); $mw-Icon( -image = 'myicon' ); sub loadIcon { return 'EOT'; /* XPM */ static char *image_xpm[] = { /* width height ncolors chars_per_pixel */ 30 30 66 1, c #002d31, . c #00314a, + c #001836, @ c #030303, # c #16b0c9, $ c #07edf2, % c #0ec9d6, c #25abca, * c #e9f8e9, = c #1999c4, - c #150205, ; c #031405, c #26c6d6, , c #040515, ' c #2fa595, ) c #cc93b8, ! c #f9e9e8, ~ c #268eb4, { c #26cde9, ] c #2b79a7, ^ c #eafbf8, / c #030625, ( c #4fc39a, _ c #011627, : c #2e7297, c #171525, [ c #2c8798, } c #27ebf6, | c #041516, 1 c #35887b, 2 c #160415, 3 c #56c6b5, 4 c #148b97, 5 c #2897c5, 6 c #03e6bb, 7 c #558377, 8 c #6a93ab, 9 c #eaebea, 0 c #1a7aa6, a c #26050d, b c #1995b5, c c #8bedf9, d c #06ebd6, e c #fdfdfd, f c #2ac5b9, g c #69aab2, h c #151407, i c #052510, j c #14a8b9, k c #28b5e5, l c #faebf7, m c #160425, n c #17b9e3, o c #518b94, p c #09c9b7, q c #27a6b8, r c #eeeddb, s c #f48af4, t c #0ea899, u c #f377f9, v c #daf6ec, w c #f8f9eb, x c #52abb1, y c #56d3e6, z c #29e6d7, A c #0bd5e5, e@@@, ~~~b~bb55~0~5~b~~]]~, @@|__~~bq=bb~b5~qj=b'~b:@, ,~]b~b55qbb1|ooo7@@ww@;-bb~~~t, m=j~o-@@[EMAIL PROTECTED], [:b[bbb5,@eew![EMAIL PROTECTED], ,,bbjq|e@eewee;=qqb, a/jq==o-eewwwwe/j##==t, ;b5#b[EMAIL PROTECTED];;j##b#, ,~j5#,[EMAIL PROTECTED],###bjb, ,j=[EMAIL PROTECTED]@-q, bj5pwewew;;@[EMAIL PROTECTED]@, qq=#jwwwl@@,,-@@ A%%@, qjj[EMAIL PROTECTED],pdA%x2%%##@, 5##jptif,su,A}A%/;#%#%@, [EMAIL PROTECTED])ddpAA@@{%%#j@, %nkA%Ad{A,,[EMAIL PROTECTED]@, ##%#%pA$AAd},@,}AAAd-9%{%%##@, #j%#,,A%AA$Ap2d}$$$,e!AdA%%%@, #%##p@;pAA$AA$.d-rcA%pA%%@, #[EMAIL PROTECTED]|^%%$A%%_@, n%%#n@,[EMAIL PROTECTED]@@, [EMAIL PROTECTED]/$$|re!-{AAA%%;@, [EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED], -j,f#/@A%$%$$,@; $$d,$$AAd%p;@, @;@%%nh%%A$$2; dzAA%,-, @eek%n-pn$Am,z}$$}d$A$AAA%n%##, eeeon%,@%(,_$d$d{3AAA%A#%%, eee,#f-@@_d{g@@m-adAA%%#8#, ee-_{;-/%dnd ,-adAA%%j,@, ee,@[EMAIL PROTECTED],,, }; EOT } HTH - Lynn. It works perfectly under all circumstances. I really want to use my icon, so does anyone know why it won't run when fired off from delphi? ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl 5.8 IIS 5.0 hangs on script failure
[EMAIL PROTECTED] wrote: Yes, I understood that in the very first email you adviced me to use eval. In fact, I replied to you saying that the script printed the error and PerlIS did not hang. But... what if I have dozens of scripts I have coded in years and all of them use one or more lines of require? do I have to recode all of those scripts that worked just fine on every earlier version of Perl just because of this bug? Well, Im not sure if this is a bug, but it is very annoying. :) To put this more visible. Some of my scripts call external files depending on query string. For example, if you type http://myhost/script.pl?page=start then start.ext is required from scripts.pl using: $page=param('page'); require $page; So if some visitor, just for curiosity or for fun, types http://myhost/script.pl?page=kakahs7ehendn (which does not exist) then with this error Perl is throwing on this version, the user would crash the server instead of receiving an error like kakahs7ehendn.ext was not found in @INC. See what I mean? It would be silly to allow a user supplied parameter to cause your script to fail. You could easily check the parameter before actually using it in a do/require. eg: if (-f $page.ext) { do $page; } # check for plain file before using You should probably also make sure you remove any /s etc from a path before shelling out or using that path in a manner that would allow the user to access other directories on the computer. An ideal solution would be to have a list of all the possible allowed pages in a hash anbd check for existence in the hash. Lack of defensive coding can only hurt you in the long run. Also, imagine that I have no admin control over the server my scripts are running and this happened? what could I do? The would I have to fix every script I have coded before because I didn't use eval? I mean, is it normal to enclose require with eval? I have seen a lot of other people's scripts and none of them use eval when requiring an external file. That is my point and the real reason why I posted this. Is that I dont get why PerlIS behaves like this in this version when earlier versions didnt act like this. I have never enclosed require lines with eval before and PerlIS never did this even if I didnt use eval. So...as is invariably the case :-) $Bill's is sound and reasoned advice. There remains that discrepancy though, between perl.exe and the DLL. I don't want to muddy the waters but as IIs is hanging, it appears it is waiting for something. Could it be as simple as '\n' following the error output? Not something you would be able to cater for in your script...but a small fix to the DLL... -Lynn's $0.02. (I communicate with some other apps that refuse to move without a '\n' or kill -9)... ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Read Fixed width database
Hi All! Is there an easy way (or module) to turn a flat fixed-width database into useful data? I would like to dump particular database fields into a hash. Tom Jones12345 Something Dr. Atlanta GA25467 JohnDoe 1704 Green Street Boston MA62481 Erica Fields 301 w Tree Circle New YorkNY91528 Would become... %hash = ( First_Name = 'Tom', Last_Name = 'Jones', City = 'Atlanta', State = 'GA', ); unpack() is your friend... use strict; my $t = EOT; Tom Jones12345 Something Dr. Atlanta GA25467 JohnDoe 1704 Green Street Boston MA62481 Erica Fields 301 w Tree Circle New YorkNY91528 EOT # 1234567890123456789012345678901234567890123456789012345678901234567890 # Tom Jones12345 Something Dr. Atlanta GA25467 my $template = a8 a9 a22 a11 a6 a6; foreach my $line(split(/\n/, $t)) { next unless($t =~ /[a-zA-Z]/); my ($fname, $lname, $street, $city, $state, $zip) = unpack($template, $line); print Name: $fname $lname\nSTREET: $street\nCITY: $city\nSTATE: $state ZIP $zip\n\n; } In the absence of evidence of a valiant attempt, I leave you to trim trailing whitespace and populate the hash ;-) -Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: subroutine name
On Friday 19 December 2003 15:41, Eckart Uhlig wrote: Hi all, is there a way to determine the name of the current called subroutine? I don't want to print out the subroutine's name explicitly, I'm hoping for a 'magic' variable/ function or something like that, which I can pass to a plain printout function. In the perlvars manpage I haven't found anything. # code snippet begin sub anySubfunc1 { Print_func_name($magic_var) # doing something } sub anySubfunc2 { Print_func_name($magic_var) # doing something } sub Print_func_name { my ($tmpname)[EMAIL PROTECTED]; print \nprocessing sub: $tmpname; } # code snippet end perldoc -f caller You'll be wanting 'caller(0)' in case the EXPR in the doc isn't clear... HTH - Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Capturing X.
Beckett Richard-qswi266 Guys, Does anyone know how to catch the user pressing the X in the corner of the window, like I can catch the Control-C? $SIG{INT} = \control_c; That's a function of the wm - use protocol to trap the event: $mw-protocol('WM_DELETE_WINDOW', [ sub {do_something()} ]); To effectively disable the x button, use an empty sub... $mw-protocol('WM_DELETE_WINDOW', [ sub { } ]); HTH - Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: unlink
Hey Listers- This is not homework. I am teaching myself perl. Question: Does the unlink command not work on windows? The book I am using has some code examples using it but I am wondering if it might be UNIX specific. I hope my code isn't that bad. Thanks! Eric Unlink works even on windoze. What isn't working for you? - Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: What about Win32-MAPI?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Guillermo Lopez Sent: Thursday, November 20, 2003 10:51 AM To: '[EMAIL PROTECTED]' Subject: What about Win32-MAPI? Hi all, Does anybody know anything about Win32-MAPI? I can not find this module anywhere. Is there any 'known substitute'? I was trying to fetch Outlook messages from Perl. I did it with this module in the past and was pretty simple. Many thanks in advance Guillermo Take a look at MAPI in: http://aspn.activestate.com/ASPN/docs/ActivePerl/faq/Windows/ActivePerl-Winfaq9.html HTH - Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How to install modules that aren't available in ActiveState's repository?
perl -MCPAN -e "install XML::SAX::Machines" There is a ton of dependencies and you will need either to ppm those with XS content first (hope they're all available...) or have MSVC installed to compile the DLLs. Checking the buildstatus pages on http://ppm.activestate.comthere appear to be more XML modules built for 5.6 than 5.8. May be worth stepping back if you have 5.8... HTH - Lynn. -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Gary NielsonSent: Tuesday, November 11, 2003 9:07 PMTo: [EMAIL PROTECTED]Subject: How to install modules that aren't available in ActiveState's repository? For example, today I went to download XML-SAX-Machines and XML-LibXML using ppm in XP. Neither one was there or complete as in: ppm install XML-SAX-MachinesError: PPD for 'XML-SAX-Machines.ppd' could not be found.ppm install XML-LibXMLError: Package 'XML-LibXML' not found. Please 'search' for it first.ppm How do I install modules in XP outside of the ppm? sage-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Jason Earl TedrickSent: Tuesday, November 11, 2003 8:43 PMTo: [EMAIL PROTECTED]Subject: Simple Script I am looking for a simple script that will go into the registry and look for the user currently logged on and display that information in an easy to read text file for a bunch of computers on the network. If I could get someone to point me in the right direction thatd be helpful, I always need a push to get me going it seemsand I am still learning so my skill is pretty newbieish*cry* ~Jason
RE: Looking for a window
Maybe useful to mention that there are a number of sample scripts included with the CPAN distro that you won't find in the ppm. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Messenger, Mark Sent: Friday, November 07, 2003 8:52 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Looking for a window You might consider Win32::GuiTest here http://triumvir.org/prog/perl/guitest/ or here: http://search.cpan.org/dist/Win32-GuiTest/GuiTest.pm Try experimenting with the functions FindWindowLike and SendKeys... This module does not seem to be in the default AS install, but is available from their PPM server: ppm install Win32-GuiTest HTH :) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Don Vansyckel Sent: Friday, November 07, 2003 6:27 PM To: [EMAIL PROTECTED] Subject: Looking for a window I have a need to do a Perl program which will 'feed' some input into a Win2000 application. I know the name of the application and the window it opens. I have looked through all the modules that seem to apply and can't find any which will 1)'watch' for a given window and 2) send input into it as though typed. Can anyone give me a point in the right direction? Thanks, Don ___ 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 attachment: winmail.dat
RE: HTML::Parser
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Noushad Dawood Sent: Thursday, October 16, 2003 10:14 AM To: [EMAIL PROTECTED] Subject: HTML::Parser I don't know why this error still comes up? I got all these files properly installed in my perl lib directory. I'm stuck with this. Can some one help me resolve this please? Thanks and regards, /nd Can't locate loadable object for module HTML::Parser in @INC (@INC contains: c:/perl/5.6.1/lib c:/perl/site/5.6.1/lib .) at c:/perl/5.6.1/lib/HTML/Entities.pm line 108 Compilation failed in require at c:/perl/5.6.1/lib/HTML/Entities.pm line 108. Compilation failed in require at c:/perl/5.6.1/lib/HTML/HeadParser.pm line 70. BEGIN failed--compilation aborted at c:/perl/5.6.1/lib/HTML/HeadParser.pm line 70. Compilation failed in require at c:/perl/5.6.1/lib/LWP/Parallel/Protocol.pm line 44. BEGIN failed--compilation aborted at c:/perl/5.6.1/lib/LWP/Parallel/Protocol.pm line 44. Compilation failed in require at c:/perl/5.6.1/lib/LWP/UserAgent.pm line 79. Compilation failed in require at c:/perl/5.6.1/lib/LWP/Simple.pm line 181. Do you have a c:\Perl\5.6.1\site\lib\auto\HTML\Parser directory with the .dll in it? I could always be wrong, but I'll guess it's looking for the dll. Also, your @INC looks to have the .../site/lib trail not quite right, compared to mine - unless that's a typo. c:/perl/site/5.6.1/lib ?? c:/perl/5.6.1/site/lib HTH - Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Tk forgetting grid labels.
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Beckett Richard-qswi266 Sent: Thursday, October 16, 2003 11:07 AM To: '[EMAIL PROTECTED]' Subject: Tk forgetting grid labels. Guys, I have a Tk GUI, which contains a notebook. On a particular page, I use grid to place some rows of labels. The user can initiate a command that results in there being less rows of labels on this page, however when they do, the old labels are still there. How do I get rid of them? I've tried: $mw-update, packForget and repacking the notebook, packForget and repack the page, but nothing seems to get rid of them. I can pack several rows of blank labels, and this clears out the old ones, but that isn't satisfactory, because I don't know how many extra rows I need to clear. There must be something simple that I'm missing! Thanks. R. If you're using grid() then you would want gridForget() HTH - Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: HTML::Parser
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Noushad Dawood Sent: Thursday, October 16, 2003 11:25 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: HTML::Parser Lynn, I've 2 sets of lib. May be it is conflicting. Now I've removed site. Still not okay with HTML::Parser. Here is the new error message. Can't locate loadable object for module HTML::Parser in @INC (@INC contains: c:/perl/5.6.1/lib .) at c:/perl/5.6.1/lib/HTML/Entities.pm line 108 Compilation failed in require at c:/perl/5.6.1/lib/HTML/Entities.pm line 108.Compilation failed in require at c:/perl/5.6.1/lib/HTML/HeadParser.pm line 70. BEGIN failed--compilation aborted at c:/perl/5.6.1/lib/HTML/HeadParser.pm line 70. Compilation failed in require at c:/perl/5.6.1/lib/LWP/Parallel/Protocol.pm line 44. BEGIN failed--compilation aborted at c:/perl/5.6.1/lib/LWP/Parallel/Protocol.pm line 44. Compilation failed in require at c:/perl/5.6.1/lib/LWP/UserAgent.pm line 79. Compilation failed in require at c:/perl/5.6.1/lib/LWP/Simple.pm line 181. Any thoughts? /nd This is where I would bow to anybody else's superior knowledge, but here's my guess. You didn't say if you found the .dll under site/lib/auto I hope you didn't physically delete site/lib - it's needed. Core modules go in lib, add-ons (as installed from CPAN or PPM) go in site/lib. I believe html::parse is one of those extras provided out-of-box by Activestate, and it should live in site/lib. Given your @INC points to c:/perl/site/5.6.1/lib, I suggest first that you check that path actually exists, and that it contains auto/HTML/Parser/Parser.dll. I just can't help thinking that's where your problem is. Did you manually relocate your installation? Lynn. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Noushad Dawood Sent: Thursday, October 16, 2003 10:14 AM To: [EMAIL PROTECTED] Subject: HTML::Parser I don't know why this error still comes up? I got all these files properly installed in my perl lib directory. I'm stuck with this. Can some one help me resolve this please? Thanks and regards, /nd Can't locate loadable object for module HTML::Parser in @INC (@INC contains: c:/perl/5.6.1/lib c:/perl/site/5.6.1/lib .) at c:/perl/5.6.1/lib/HTML/Entities.pm line 108 Compilation failed in require at c:/perl/5.6.1/lib/HTML/Entities.pm line 108. Compilation failed in require at c:/perl/5.6.1/lib/HTML/HeadParser.pm line 70. BEGIN failed--compilation aborted at c:/perl/5.6.1/lib/HTML/HeadParser.pm line 70. Compilation failed in require at c:/perl/5.6.1/lib/LWP/Parallel/Protocol.pm line 44. BEGIN failed--compilation aborted at c:/perl/5.6.1/lib/LWP/Parallel/Protocol.pm line 44. Compilation failed in require at c:/perl/5.6.1/lib/LWP/UserAgent.pm line 79. Compilation failed in require at c:/perl/5.6.1/lib/LWP/Simple.pm line 181. Do you have a c:\Perl\5.6.1\site\lib\auto\HTML\Parser directory with the .dll in it? I could always be wrong, but I'll guess it's looking for the dll. Also, your @INC looks to have the .../site/lib trail not quite right, compared to mine - unless that's a typo. c:/perl/site/5.6.1/lib ?? c:/perl/5.6.1/site/lib HTH - Lynn. ** The contents of this mail are personal opinions of the Author. ADIA disclaims all responsibility and accepts no liability, whatsoever. ** ___ 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: TK positioning viewable area of scrolled rotext
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Beckett Richard-qswi266 Sent: Wednesday, October 08, 2003 6:52 AM To: '[EMAIL PROTECTED]' Subject: TK positioning viewable area of scrolled rotext Guys, I am using a scrolled rotext widget with 2 lines as a status bar, so that the user can scroll backwards over the messages. How do I make the widget display the bottem of the scrolled area, rather than the top? Thanks. $t-see('end') ? - works on text widget. -Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Capturing the output of a sytem() command
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Thomas, Mark - BLS CTR Sent: Monday, October 06, 2003 11:21 AM To: 'George Gallen'; [EMAIL PROTECTED] Subject: RE: Capturing the output of a sytem() command Let me clarify ths slightly. I'm using backticks to run the command, so I can capture the output. But How do I read it sequentially, line by line. I'm converting a file from ASCII - BASE64, and want to read the converted file directly from the base64 conversion routine. Something like: my $exe = $path/to/base64.exe; my $cmd = $exe . required_args_to_read_file_and_send_output_to_stdout; open CMD, $cmd | ; foreach my $line(CMD) { print LINE = . $line; #do stuff } close(CMD); HTH - Lynn; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Capturing the output of a sytem() command
-Original Message- From: Lynn. Rickards [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2003 12:43 PM To: 'George Gallen'; '[EMAIL PROTECTED]' Subject: RE: Capturing the output of a sytem() command -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Thomas, Mark - BLS CTR Sent: Monday, October 06, 2003 11:21 AM To: 'George Gallen'; [EMAIL PROTECTED] Subject: RE: Capturing the output of a sytem() command Let me clarify ths slightly. I'm using backticks to run the command, so I can capture the output. But How do I read it sequentially, line by line. I'm converting a file from ASCII - BASE64, and want to read the converted file directly from the base64 conversion routine. Something like: my $exe = $path/to/base64.exe; my $cmd = $exe . required_args_to_read_file_and_send_output_to_stdout; open CMD, $cmd | ; foreach my $line(CMD) { print LINE = . $line; #do stuff } close(CMD); HTH - Lynn; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Spreadsheet-like data entry/editing in PerlTk?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dax T. Games Sent: Tuesday, September 30, 2003 8:12 AM To: [EMAIL PROTECTED] Subject: Spreadsheet-like data entry/editing in PerlTk? Does anyone know of a Tk widget or have some sample code that would allow data entry and editing like with a spreadsheet in PerlTk. Currently I am familiar with the HList widget but as far as I know it only will list what you populate it with you cannot enter data or edit data. Thanks, Dax http://www.cpan.org/modules/by-module/Tk/ Look for Tk-TableMatrix. Also available on ppm from AS. -Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl editors
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of $Bill Luebkert Sent: Monday, September 22, 2003 8:39 PM To: [EMAIL PROTECTED] Subject: Re: Perl editors Cameron Dorey wrote: REAL (old) men use the toggle switches on the front of the box! A fellow operator and myself used to clear core on IBM 360's - simultaneously reaching and flipping toggles and pushing buttons (memorized and choreographed to perfection - arms crossing each other back and forth). We had every person that walked in and saw us do it totally amazed, but once you learned the moves, it was all a breeze. Fun to do and a great way to show off to the non-operators that transgressed into our realm. :) So that was the _original_ Castle of Medieval Myth Magic? -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: empty versus zero
I think this is a fairly simple question... How can I count empty values in an array? This count should not include zeros or non-empty values. Below is my current script, but it isn't working properly. I appreciate any assitance that you may provide. Thank you, David #!perl -w # Count missing values while (my $line = ) { chomp ($line); my ($probe_id,$expression) = split /\t/, $line, 2; my @expression = split /\t/, $expression; my $count = 0; foreach my $value (@expression) { # if (!$value) { One way could be to use defined() unless(defined($value)) $count += 1; # } } print $count\n; } ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: empty versus zero
Thanks Will but I'll own up to maybe not reading the spec closely enough. Is the string to be considered empty? It passes defined() nevertheless...as does the empty string ''. Embarrassing. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Will of Thornhenge Sent: Wednesday, August 13, 2003 8:36 PM To: [EMAIL PROTECTED] Cc: 'David Byrne' Subject: Re: empty versus zero I prefer Lynn. Rickards' method to the others I've seen mentioned. Testing whether the value is defined will always work quietly and swiftly; several of the other tests proposed will generate warnings under some conditions, which can really bog down a loop. Lynn. Rickards wrote: I think this is a fairly simple question... How can I count empty values in an array? This count should not include zeros or non-empty values. Below is my current script, but it isn't working properly. I appreciate any assitance that you may provide. Thank you, David #!perl -w # Count missing values while (my $line = ) { chomp ($line); my ($probe_id,$expression) = split /\t/, $line, 2; my @expression = split /\t/, $expression; my $count = 0; foreach my $value (@expression) { # if (!$value) { One way could be to use defined() unless(defined($value)) $count += 1; # } } print $count\n; } Another way, utilizing the magic for and defined do with $_: for (@expression) { $count++ if not defined} print $count, \n; So lots of different ways to do it. -- Will Woodhull [EMAIL PROTECTED] ___ 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: What is wrong with this?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of steve silvers Sent: Tuesday, August 12, 2003 9:53 AM To: [EMAIL PROTECTED] Subject: What is wrong with this? I don't understand why the output of the below snippet kind of blows up.. --TEXT FILE test.txt-- 03|04|09|14|15|18|24|27 09|23|24|26|27|28|33|35 10|11|13|15|17|18|19|22 07|08|13|17|22|23|24|25 03|06|07|08|11|12|16|17 02|05|06|09|12|18|19|22 --SCRIPT #!Perl -w use strict; use vars qw(%counts $numbers @numbers); open(FILE,test.txt) || die Can't open file $^E; while(FILE) { push(@numbers, split(/\|/,$_)); } close(FILE); # - # Get Count.. $counts{$_}++ foreach @numbers; foreach (sort { $counts{$b} = $counts{$a} } keys %counts) { print qq( $_ - $counts{$_} \n); } -- RESULTS -- 18 - 3 24 - 3 09 - 3 07 - 2 23 - 2 15 - 2 08 - 2 17 - 2 19 - 2 03 - 2 11 - 2 12 - 2 13 - 2 06 - 2 22 - 2 22 - 1 25 - 1 17 - 1 35 - 1 27 - 1 02 - 1 05 - 1 16 - 1 33 - 1 04 - 1 26 - 1 10 - 1 14 - 1 27 - 1 28 - 1 Why do the last numbers as it seems is blowing out and not keep a nice form like the rest of the results? It seems likes it's just the last numbers? @numbers is getting the carriage returns... while(FILE) { chomp; # push(@numbers, split(/\|/,$_)); } hth...Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs