[16055] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3467 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 23 18:10:36 2000

Date: Fri, 23 Jun 2000 15:10:25 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <961798224-v9-i3467@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 23 Jun 2000     Volume: 9 Number: 3467

Today's topics:
    Re: How can I Use a Perl Script to FTP files automatica eedlin@my-deja.com
    Re: How can I Use a Perl Script to FTP files automatica faatdilac@my-deja.com
    Re: IDE for perl? <brent.schenk@home.com>
        install Apache::Cookie for Win32? was: mod_perl setup f Tom_Roche@ncsu.edu
    Re: logs of BigFloats, binomial density function, large <jjchew@math.utoronto.ca>
    Re: Monitor a process like Unix top But should be Perl/ <tony_curtis32@yahoo.com>
    Re: Monitor a process like Unix top But should be Perl/ (Randal L. Schwartz)
    Re: Net::NNTP question. <rootbeer@redcat.com>
    Re: NOT a Newbie Form - Perl - mail?! (Bart Lateur)
    Re: Passing filehandles to subroutines (Mike)
    Re: Passing filehandles to subroutines (Greg Bacon)
    Re: Passing filehandles to subroutines (Greg Bacon)
    Re: Passing filehandles to subroutines (Greg Bacon)
    Re: Passing filehandles to subroutines <flavell@mail.cern.ch>
    Re: Perl 5.6 says 'syntax error', Perl 5.005_03 does no (Bart Lateur)
    Re: Perl Network Programming (Greg Bacon)
        perl4 out of memory on HPUX (Alex Graf)
    Re: perl4 out of memory on HPUX (Alex Graf)
    Re: PPM Hotfix Fails <abe@ztreet.demon.nl>
        Quick "Perl Way" solution needed <church.jeff@orbital.com>
    Re: Quick "Perl Way" solution needed (Craig Berry)
    Re: Quick "Perl Way" solution needed <mjcarman@home.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 23 Jun 2000 21:37:42 GMT
From: eedlin@my-deja.com
Subject: Re: How can I Use a Perl Script to FTP files automatically
Message-Id: <8j0lb5$lqo$1@nnrp1.deja.com>

In article
<Pine.LNX.4.10.10006231018070.6359-100000@newby.cs.ualberta.ca>,
  Weiguang Shi <wgshi@newby.cs.ualberta.ca> wrote:
> Hi,
>
> I got into exactly your problem months ago and got it solved by using
the
> Net::FTP module. It's easy as the man page of it gives an example like
> this:
>
>            use Net::FTP;
>
>            $ftp = Net::FTP->new("some.host.name", Debug => 0);
>            $ftp->login("anonymous",'me@here.there');
>            $ftp->cwd("/pub");
>            $ftp->get("that.file");
>            $ftp->quit;
>
> The disadvantage is that the password has to be supplied and
transmitted
> transparent. May be some guru can tell how can do it securely.

The most straight forward way would be to not have the passwd in the
script at all and have it passed in through a command line arg.  If the
script is being run by cron or similar then that does not help much.
You could always make it an executable and someone would have to
"de-compile" the code to get it out.
>
> Weiguang
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Fri, 23 Jun 2000 21:47:56 GMT
From: faatdilac@my-deja.com
Subject: Re: How can I Use a Perl Script to FTP files automatically
Message-Id: <8j0lu6$m8u$1@nnrp1.deja.com>

In article <8j0lb5$lqo$1@nnrp1.deja.com>,
  eedlin@my-deja.com wrote:
> In article
> <Pine.LNX.4.10.10006231018070.6359-100000@newby.cs.ualberta.ca>,
>   Weiguang Shi <wgshi@newby.cs.ualberta.ca> wrote:
> > Hi,
> >
> > I got into exactly your problem months ago and got it solved by
using
> the
> > Net::FTP module. It's easy as the man page of it gives an example
like
> > this:
> >
> >            use Net::FTP;
> >
> >            $ftp = Net::FTP->new("some.host.name", Debug => 0);
> >            $ftp->login("anonymous",'me@here.there');
> >            $ftp->cwd("/pub");
> >            $ftp->get("that.file");
> >            $ftp->quit;
> >
> > The disadvantage is that the password has to be supplied and
> transmitted
> > transparent. May be some guru can tell how can do it securely.
>
> The most straight forward way would be to not have the passwd in the
> script at all and have it passed in through a command line arg.  If
the
> script is being run by cron or similar then that does not help much.
> You could always make it an executable and someone would have to
> "de-compile" the code to get it out.
> >
> > Weiguang
> >
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Or use the Expect module of Perl.
faatdilac


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Mon, 19 Jun 2000 14:25:04 GMT
From: "Brent Schenk" <brent.schenk@home.com>
Subject: Re: IDE for perl?
Message-Id: <394E2CB7.0@NEWS>

Try NoteTab I use it.  You can pick it up at Tucows!  It's a Great Program.
If you are using a Mac then try using BBEdit.  That's a great program too!
Alvin Stroyny <strny_mp@euronet.nl> wrote in message
news:394E296B.F66180A2@euronet.nl...
> Hi
>
> Can anyone recommend me a good integrated development environment (i.e.
> editor+debugger)
> for perl? I am interested in both commercial and shereware products.
>
> Thanks
>
> michael
>




------------------------------

Date: Thu, 22 Jun 2000 16:00:47 -0400
From: Tom_Roche@ncsu.edu
Subject: install Apache::Cookie for Win32? was: mod_perl setup for w2k?
Message-Id: <3952706F.4FDA2611@ncsu.edu>

Tom Roche 6/16/00 6:52PM
>> I`ve also found Randy Kobes` mod_perl binaries at

>> ftp://theoryx5.uwinnipeg.ca/pub/other/ 

>> and am planning to try perl-win32-bin-0.6.exe. If anyone has already
>> gotten mod_perl running on w2k, I`d appreciate your recommendations
>> (or pointers to documentation)

"Russell Lundberg" <russell_lundberg@csi.com> 6/17/00 12:01:17 PM >>>
> I got Randy's mod_perl binary running on my Thinkpad 600 with no
> problem. <snip> You'll be surprised how easy it is.

> Thanks Randy for the perl-win32-bin-0.6.exe binary.

Indeed! I bow in the general direction of Winnipeg. A few tweaks to
httpd.conf-perl, install the service per

http://apache.org/docs/windows.html

and Apache::Hello is doing its thing on w2k. 

However, the site that I want to port from Solaris Apache to Windows
Apache uses Apache::Cookie, so I got

> [error] Can't locate Apache/Cookie.pm in @INC

in the error_log. I was unable to install the module using CPAN.pm
(seems to be a combination of server directories not being where
CPAN.pm wants them to be, and the win32 ncftpget.exe not taking the
switches CPAN.pm wants to give it), so I copied the .../Apache.pm and
 .../Apache/*.pm from the working Solaris site. Now I get

> [error] Can't locate loadable object for module Apache::Cookie in
> @INC ... at d:/ProgramFiles/Perls/GNU/site/5.6.0/lib/mod_perl.pm
> line 14

which is

> if ($ENV{MOD_PERL}) {
>     (defined &{$class.'::bootstrap'} ?
>      \&{$class.'::bootstrap'} :
>      \&DynaLoader::bootstrap)->
>          ($class, $version);
> }

After a bit of research, I'm wondering: 

? Is this libapreq related? If so, is there a libapreq for win32? I've
  seen the ominous

  [modperl] Re: failure: libapreq + win32
  Doug MacEachern (dougm@cp.net)
  Mon, 10 May 1999 14:40:20 -0700 (PDT)

  and am hoping someone's gotten this working in the past year (oh
  please :-) Otherwise, is there a workaround?

? If not, what's wrong?

? Is there a win32 installer for Apache::Cookie out there anywhere?

Please reply directly to me as well as the list, and TIA,
Tom_Roche@ncsu.edu


------------------------------

Date: Fri, 23 Jun 2000 14:57:53 -0400
From: John J Chew <jjchew@math.utoronto.ca>
Subject: Re: logs of BigFloats, binomial density function, large factorials
Message-Id: <B5792B71.43FD%jjchew@math.utoronto.ca>

In article 8im6b3$5un$1@nnrp1.deja.com, mnanao@my-deja.com at
mnanao@my-deja.com wrote on 2000 06 19 18:20:

> I'm trying to compute NON-cumulative binomial density functions
> of rather large N (>1000).  In other words, for a set of N trials,
> I want to know the probabilty of getting *exactly* n "positives" of
> probability p.  As a result, I need to calculate factorials
> of these large N  which easily overflow perls ~1x10^308 limit.

> Any ideas?  No solution is too hackish at this point!  I just want to
> get the stupid thing to WORK!  Thanks in advance,

It sounds as though you need to reexpress the formula that you are
using so that you don't get overflows in mid-calculation.  For instance,
don't calculate a huge numerator and then divide it by a huge denominator,
but express such fractions as products of lots of simpler fractions with
smaller parts.  To find out how to do this accurately you may need to
consult a numerical methods text.

Alternately, if you have something that works for calculating cumulative
distributions, have you considered calculating differences of cumulative
distributions to get what you want?

And finally, if neither of these works, why not post the code that is
currently overflowing and see if anyone here can suggest a better fix?

John
-- 
John J. Chew, III
jjchew@math.utoronto.ca * http://www.math.utoronto.ca/jjchew




------------------------------

Date: Tue, 20 Jun 2000 07:56:43 GMT
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Monitor a process like Unix top But should be Perl/tk How?
Message-Id: <87AEGIIAZ3.FSF@LIMEY.HPCC.UH.EDU>

>> On Mon, 19 Jun 2000 05:40:06 +0200,
>> "Charles W.W." <kingwang98@yahoo.com> said:

> Thank you.  It is not a homework. It is a project I have
> to finish in 2 weeks. I need to monitor the several user
> and display in a perfect GUI window( some graphic
> diagram maybe necessary) to show whether the process is

> Is there any modules available for that?

What did you find when you went to http://search.cpan.org/
and looked for "top"?

--
"Trying is the first step towards failure"
                                           Homer Simpson


------------------------------

Date: Tue, 20 Jun 2000 13:47:56 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Monitor a process like Unix top But should be Perl/tk How?
Message-Id: <M11Z1TBRWF.FSF@HALFDOME.HOLDIT.COM>

>>>>> "Drew" == Drew Simonis <care227@attglobal.net> writes:

Drew> "Charles W.W." wrote:
>>
>>
>> JAPH
Drew>   ^^^^

Drew> Somehow I have my doubts.

Yeah, it was sorta cute when that actually meant something, eh? :)

Just the *original* JAPH,

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: Mon, 19 Jun 2000 17:08:21 GMT
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Net::NNTP question.
Message-Id: <PINE.GSO.4.10.10006191005390.29843-100000@USER2.TELEPORT.COM>

On Mon, 19 Jun 2000, DougW wrote:

> Using Activestate perl and Net::NNTP
>
> So far I have been able to post (easy)
> but I need an example of how to interact.

Between the docs for Net::NNTP and RFC-977, I don't know what more you
want.

> The goal is a bot that searches a specific news group for a REQ:
> (request) then fills that request.

You're new here, aren't you. :-)

> To that end I'd also appreciate it if someone could
> point me to a UUEncode/UUDecode library.  I could
> code it myself but I'd rather not.

Then you should look on CPAN.

    http://search.cpan.org/

> Oh, the email address in my post is bogus.
> Sorry, I get entirely too much spam as it is.

Odd. My real address is on my postings, but I spend more time each week
dealing with _paper_ junk mail. I doubt that hiding your address helps you
as much as you think.

Cheers!

--
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Fri, 23 Jun 2000 19:51:08 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: NOT a Newbie Form - Perl - mail?!
Message-Id: <39534fda.1879753@news.skynet.be>

Jon Langley wrote:

>When I ring up the Web Server, they say that they dont have sendmail and
>they always suggest blat to everyone.

That means your ISP is working with Windows. Oh dear.

-- 
	Bart.


------------------------------

Date: Fri, 23 Jun 2000 14:59:14 GMT
From: tcsh@holly.colostate.edu (Mike)
Subject: Re: Passing filehandles to subroutines
Message-Id: <SLRN8L63EK.S06.TCSH@FAURE.CS.COLOSTATE.EDU>

gbacon@HiWAAY.net (Greg Bacon):
>
> to help yourself.  That's why we ask people to read the FAQ first,
> *BEFORE* posting.  As you've so nicely demonstrated, when people don't

The FAQ is not something I can see reading from start to finish.  When I need
an answer, I search for it.  I didn't think is was a FAQ, as a search for
'filehandle' at perlfaq.com didn't turn up the needed information.

>
> You need to upgrade.  It's often easier to just grep the pods.  Do
> you know how to find the pods in your Perl installation?

I'm not the sysadmin and have a tight disk usage quota so an upgrade isn't
possible.  But thanks for the grepping the pods idea, I'll surely use that
in the future.

--
Mike


------------------------------

Date: Fri, 23 Jun 2000 19:34:53 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Passing filehandles to subroutines
Message-Id: <sl7eutbee7f126@corp.supernews.com>

In article <slrn8l63ek.s06.tcsh@faure.cs.colostate.edu>,
    Mike <tcsh@holly.colostate.edu> wrote:

: gbacon@HiWAAY.net (Greg Bacon):
:
: > to help yourself.  That's why we ask people to read the FAQ first,
: > *BEFORE* posting.  As you've so nicely demonstrated, when people don't
: 
: The FAQ is not something I can see reading from start to finish.

Modify your vision until you can see it.  How do you think most of
the answerers know to refer people to the FAQ?  I've read the entire
FAQ.  I'd take 3:1 odds that Abigail, rootbeer, mjd, merlyn, etc.
have all read the FAQ (probably several times each).  Yes, searching
is very nice when you're in a hurry, and in those cases you can

    % grep -i word perlfaq*

or grep the heads and then grep them.

:                                                                   When
: I need an answer, I search for it.

Take a hint from computers.  When it will be to their advantage to
recall something quickly, they put it in cache.  Load your cache
unless you like constantly spinning your wheels on (sometimes tough)
searches.  You can pick up lots of cool tricks by reading the FAQ.

:                              I didn't think is was a FAQ,

They never do... :-)

:                                                           as a search
: for 'filehandle' at perlfaq.com didn't turn up the needed information.

More evidence for my case that you should read the whole FAQ.

: > You need to upgrade.  It's often easier to just grep the pods.  Do
: > you know how to find the pods in your Perl installation?
: 
: I'm not the sysadmin and have a tight disk usage quota so an upgrade isn't
: possible.  But thanks for the grepping the pods idea, I'll surely use that
: in the future. 

Lean on your sysadmin until he upgrades.  Depending on how old your
perl is, you can present a very convincing argument (think CERT
advisories).

Greg
-- 
It will be generally found that those who sneer habitually at human
nature and affect to despise it, are among its worst and least pleasant
examples.
    -- Charles Dickens


------------------------------

Date: Fri, 23 Jun 2000 19:41:26 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Passing filehandles to subroutines
Message-Id: <sl7fb6hke7f102@corp.supernews.com>

In article <slrn8l63ek.s06.tcsh@faure.cs.colostate.edu>,
    Mike <tcsh@holly.colostate.edu> wrote:

: [...] I didn't think is was a FAQ, as a search for 'filehandle' at
: perlfaq.com didn't turn up the needed information.

Oh, I saw perlfaq.com and thought perl.com.  perlfaq' isn't presented
linearly (i.e., not in such a way that would facilitate straight
through reading), but it's still possible.  It's my understanding that
Joseph wants to create a separate yet complete FAQ.  Right now, one
is better in some areas, and one is better in others.  Someone should
make a MetaFAQ for searching them both.

Consider contributing a new entry to the perlfaq.org database.

Greg
-- 
UNIX is running on at least five PDP-11, no two with the same complement
of hardware.
    -- dmr (circa 1972)


------------------------------

Date: Fri, 23 Jun 2000 19:47:27 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Passing filehandles to subroutines
Message-Id: <sl7fmfoae7f68@corp.supernews.com>

In article <slrn8l63ek.s06.tcsh@faure.cs.colostate.edu>,
    Mike <tcsh@holly.colostate.edu> wrote:

: gbacon@HiWAAY.net (Greg Bacon):
:
: > You need to upgrade.  It's often easier to just grep the pods.  Do
: > you know how to find the pods in your Perl installation?
: 
: I'm not the sysadmin and have a tight disk usage quota so an upgrade isn't
: possible.  But thanks for the grepping the pods idea, I'll surely use that
: in the future. 

Another advantage to reading the FAQ: you'd have seen

    How can I convince my sysadmin/supervisor/employees to use version
    (5/5.004/Perl instead of some other language)?

at <URL:http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_can_I_convince_my_sysadmin_s>.

Greg
-- 
Of course, this is a heuristic, which is a fancy way of saying that it
doesn't work.
    -- mjd


------------------------------

Date: Fri, 23 Jun 2000 22:01:29 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Passing filehandles to subroutines
Message-Id: <Pine.GHP.4.21.0006232158030.13079-100000@hpplus03.cern.ch>

On Fri, 23 Jun 2000, Mike wrote:

> The FAQ is not something I can see reading from start to finish. 

Oh, you should, if only to get the flavour of what's in there.  Keep a
copy in the smallest room, to browse now and again in odd moments. The
great thing about FAQs is they also answer questions that you didn't
realise you needed to ask.

Of course when you actually _need_ it, you'll have your computer to
help you, with a search and so on, as you rightly said.

-- 

        "Mir ist es ein Rätsel wie man mit minimalem Verstand so einen 
         Unfug fabrizieren kann."   - Adrian Knoth




------------------------------

Date: Fri, 23 Jun 2000 20:41:29 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl 5.6 says 'syntax error', Perl 5.005_03 does not
Message-Id: <3954c2a6.1151832@news.skynet.be>

Jeff Boes wrote:

>I've read the half-dozen or so responses, for which I'm grateful. But I
>guess I was looking for something a little more definite. Is this a
>mis-use of the Perl syntax under 5.005_03 (in other words, a bug in the
>original Perl code supplied by Mandrake)? Or is this a flaw in Perl 5.6
>which fails to be backward-compatible with previously valid syntax?

I think it's simply a problem of ambiguous syntax. Both interpetations,
code block or anonymous array, are valid. But in case of an anonymous
array (an expression), it will complain about a missin comma.

However, I think that map and grep should give a clear preference for
the "code block" over expression: if the first parameter LOOKS LIKE a
code block, then it IS a code block.

-- 
	Bart.


------------------------------

Date: Fri, 23 Jun 2000 19:20:33 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Perl Network Programming
Message-Id: <sl7e415oe7f76@corp.supernews.com>

In article <395264B2.24D9B290@attglobal.net>,
    Drew Simonis  <care227@attglobal.net> wrote:

: Greg Bacon [allegedly] wrote:
: > 
: > : $input = <STDIN>; #user inputs: 12345?
: > : chop ($input);
: 
: Isn't it better to use chomp() instead of chop()?

Usually, but it's even better to be careful about your attribution.

Greg
-- 
Working in groups is difficult when you're omnipotent.
    -- Q


------------------------------

Date: Fri, 23 Jun 2000 20:15:24 GMT
From: alex.graf@ec.gc.ca (Alex Graf)
Subject: perl4 out of memory on HPUX
Message-Id: <3953bde1.71125844@morgoth.sfu.ca>


Of course I don't expect any follow-up on this, but just FYI:

I am using perl4 (version info below), on an HP 9000/725.

My program occasionally ends with an "Out of memory!" error.
'top' indicates that there is plenty of memory available, and that the
memory size of the process does not change while it is running.  The
program creates no huge data structures, though it does fork off a lot
of children (it is a server).  I am unable to consistently duplicate
the error, it just happens when it happens.

Alex

----------
This is perl, version 4.0

$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36

Copyright (c) 1989, 1990, 1991, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 4.0 source
kit.




------------------------------

Date: Fri, 23 Jun 2000 20:16:29 GMT
From: alex.graf@ec.gc.ca (Alex Graf)
Subject: Re: perl4 out of memory on HPUX
Message-Id: <3953c58b.73088325@morgoth.sfu.ca>



HP-UX 10.20



On Fri, 23 Jun 2000 20:15:24 GMT, alex.graf@ec.gc.ca (Alex Graf)
wrote:

>
>Of course I don't expect any follow-up on this, but just FYI:
>
>I am using perl4 (version info below), on an HP 9000/725.
>
>My program occasionally ends with an "Out of memory!" error.
>'top' indicates that there is plenty of memory available, and that the
>memory size of the process does not change while it is running.  The
>program creates no huge data structures, though it does fork off a lot
>of children (it is a server).  I am unable to consistently duplicate
>the error, it just happens when it happens.
>
>Alex
>
>----------
>This is perl, version 4.0
>
>$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
>Patch level: 36
>
>Copyright (c) 1989, 1990, 1991, Larry Wall
>
>Perl may be copied only under the terms of either the Artistic License
>or the
>GNU General Public License, which may be found in the Perl 4.0 source
>kit.
>
>



------------------------------

Date: Fri, 23 Jun 2000 15:33:24 GMT
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: PPM Hotfix Fails
Message-Id: <AD07LSKPAPNGI3M8CDOQMLJ0A70485738J@4AX.COM>

[Please state your response _after_ the quoted/trimmed text you are
responding to]

On Fri, 23 Jun 2000 12:43:39 GMT, bayers@my-deja.com wrote:

> In article <8iv3jj$3fs$1@orpheus.gellyfish.com>,
>   Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> > On Thu, 22 Jun 2000 15:26:00 GMT bayers@my-deja.com wrote:
[...]
> > > C:\Perl\bin>perl -x -S "ppm"  verify --upgrade --location=. PPM
> > > Cannot forceunlink C:\Perl\bin\ppm.bat: Permission denied at
> >
> > So why dont you change attributes of the file and run it again ?
> >
> Its permissions are set to 'everyone' and it has no attributes set.
>
> Very strange.

The above statement will let perl run 'ppm.bat', there may be a problem
unlinking _itself_.

It looks as if the rest of the fix succeded, so you could remove ppm.bat
yourself and run:

	C:\Perl\bin\>pl2bat ppm.pl



--
Good luck,
Abe


------------------------------

Date: Fri, 23 Jun 2000 20:07:02 +0000
From: J Church <church.jeff@orbital.com>
Subject: Quick "Perl Way" solution needed
Message-Id: <3953C366.EEB592B1@orbital.com>

From the Block below , I was wondering if anyone wants to take
a shot at a quick "Perl Way" solution:

I want to print the numbers in the last field in such a way
that each sequence of consecutive numbers are considered
seperate ranges, and are the only values extracted.

The output would be something like:
------------------------------------------------------------
Bad Scan Ranges: Low       High
                                     688        692
                                    1039      1042
                                    1635      1638
------------------------------------------------------------
 .
 .     (This the raw data with the desired values)
 .
-W- getl0scene_nav.c: bad navigation at scan 688 <-----low
-W- getl0scene_nav.c: bad navigation at scan 689
-W- getl0scene_nav.c: bad navigation at scan 690
-W- getl0scene_nav.c: bad navigation at scan 691
-W- getl0scene_nav.c: bad navigation at scan 692 <-----high
-W- getl0scene_nav.c: bad navigation at scan 1039<-----low
-W- getl0scene_nav.c: bad navigation at scan 1040
-W- getl0scene_nav.c: bad navigation at scan 1041
-W- getl0scene_nav.c: bad navigation at scan 1042<-----high
-W- getl0scene_nav.c: bad navigation at scan 1635<-----low
-W- getl0scene_nav.c: bad navigation at scan 1636
-W- getl0scene_nav.c: bad navigation at scan 1637
-W- getl0scene_nav.c: bad navigation at scan 1638<-----high
 .
 .
 .
(approx. 20,000 more lines grouped this way)


I know there is probably a ton of ways to do some thing
like this in Perl , Gawk, ..

I'm just looking for a quick "Perl Way" Solution.
   Thanks, Jeff
   church.jeff@orbital.com




------------------------------

Date: Fri, 23 Jun 2000 21:50:42 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Quick "Perl Way" solution needed
Message-Id: <sl7mti7be7f61@corp.supernews.com>

J Church (church.jeff@orbital.com) wrote:
: I want to print the numbers in the last field in such a way
: that each sequence of consecutive numbers are considered
: seperate ranges, and are the only values extracted.
[snip]
: I'm just looking for a quick "Perl Way" Solution.

How about:

#!/usr/bin/perl -w
# ranger - parse log numbers into ranges (clpm demo)
# Craig Berry (20000623)

use strict;

print "Bad Scan Ranges:\tLow\tHigh\n";

my $oldNum = -2;   # Assumes valid lines numbers are >= 0.
my $num;

while (<DATA>) {
  ($num) = /scan (\d+)/;

  if ($num != $oldNum + 1) {
    print "\t$oldNum\n" if $oldNum >= 0;
    print "\t\t\t$num";
  }

  $oldNum = $num;
}

print "\t$num\n";

__DATA__
-W- getl0scene_nav.c: bad navigation at scan 688
-W- getl0scene_nav.c: bad navigation at scan 689
-W- getl0scene_nav.c: bad navigation at scan 690
-W- getl0scene_nav.c: bad navigation at scan 691
-W- getl0scene_nav.c: bad navigation at scan 692
-W- getl0scene_nav.c: bad navigation at scan 1039
-W- getl0scene_nav.c: bad navigation at scan 1040
-W- getl0scene_nav.c: bad navigation at scan 1041
-W- getl0scene_nav.c: bad navigation at scan 1042
-W- getl0scene_nav.c: bad navigation at scan 1635
-W- getl0scene_nav.c: bad navigation at scan 1636
-W- getl0scene_nav.c: bad navigation at scan 1637
-W- getl0scene_nav.c: bad navigation at scan 1638


-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


------------------------------

Date: Fri, 23 Jun 2000 16:10:20 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Quick "Perl Way" solution needed
Message-Id: <3953D23C.9C3A7FDC@home.com>

J Church wrote:
> 
> From the Block below , I was wondering if anyone wants to take
> a shot at a quick "Perl Way" solution:

Doubtful (at least for the old timers). Local etiquette requires that
you try to do things for yourself first. In other words, this is a forum
for help and not a script-writing service.

Note: I'm not trying to be arrogant or unhelpful, so don't take this all
too personally. I'm trying to teach you about the culture of Perl and
this newsgroup. Ignore the local customs at your own peril.

> I want to print the numbers in the last field in such a way
> that each sequence of consecutive numbers are considered
> seperate ranges, and are the only values extracted.

[snip]

Sounds easy enough. Since you seem to be missing an algoritm, I'll
provide a simple one:

Read the file a line at a time, stripping out the numbers. Keep a copy
of the previous number, as well as vars for the low/high. If the current
number equals the previous number plus one, you're in a range, take the
current number as the new high end and keep going. Otherwise, your range
has ended. Print out the current range and set the save the current
number as the low end of your new range.

It's probably fewer keystrokes to write that in Perl. Try coding it up,
and let us know if you have problems (that aren't answered in the docs).

-mjc


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 3467
**************************************


home help back first fref pref prev next nref lref last post