[13947] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1357 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 12 03:06:34 1999

Date: Fri, 12 Nov 1999 00:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942393914-v9-i1357@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 12 Nov 1999     Volume: 9 Number: 1357

Today's topics:
    Re: Can Perl Modules help me? (Asher)
    Re: function: full(\*FILEHANDLE) <jeffp@crusoe.net>
    Re: Generating pi (Alan Barclay)
    Re: Generating pi (Craig Berry)
    Re: Generating pi <lr@hpl.hp.com>
    Re: Generating pi (Ilya Zakharevich)
    Re: GURU HELP NEEDED FOR NEWBIE <jeff@vpservices.com>
    Re: GURU HELP NEEDED FOR NEWBIE <jeffp@crusoe.net>
    Re: Help needed fast please <lr@hpl.hp.com>
    Re: Help with Stoopid Nutscrape (Netscape) (David H. Adler)
    Re: Help: Form returns &#8220; instead of " a left doub (www.www2.internetpros.com)
    Re: How to encrypt a web log-in, and work w/accounts in (Abigail)
    Re: How to not print Header in my page? (Abigail)
    Re: Jobs Opportunities at CitySearch (Randal L. Schwartz)
    Re: mySql, DBI, and pop-up menus (Abigail)
        Need help with arrays. <snapperhead_420NOsnSPAM@hotmail.com.invalid>
    Re: Perl Interpreter in Java (Abigail)
    Re: Removing leading zeros from a string? (Abigail)
    Re: Removing occurrences of a string from another strin (Craig Berry)
    Re: Removing occurrences of a string from another strin (Abigail)
    Re: Senior Software Engineer (Perl)-Positions Available (Iain Chalmers)
    Re: sorting withing multiple files (Abigail)
    Re: Style Sheets crash netscape <mryan@kc4.so-net.ne.jp>
    Re: using the 'Location :' command KernelKlink@webtv.net
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 12 Nov 1999 06:33:18 GMT
From: asher@magicnet.net (Asher)
Subject: Re: Can Perl Modules help me?
Message-Id: <slrn82nf64.1q5.asher@localhost.localdomain>

On Thu, 11 Nov 1999 11:18:13 -0600, Peter <peterclones@yahoo.com> wrote:
>I've made a web chatroom using Perl cgi and it works fine, but it gets
>sluggish as more people enter the room of course.  The script I have writes
>messages to a common text file, then is read by all the users every few
>seconds.  I don't know anything about modules, so I'm wondering if there's
>someway modules could speed up this process?  If so, which ones should I be
>looking at and how can I get help implementing them.  Just need to be
>pointed in the right direction.
>
>Peter
>
The problem may be the CGI process overhead, which only becomes
noticeable when the server is heavily loaded.  One way to 'profile'
a CGI script is to record the hi-res time at several milestones in
the script (see perlfaq8, How can I measure time under a second?) and
print a table on the returned web page.  This could tell you if the
script is blocking on file I/O or just taking a long time to start.

If the file I/O is the problem, consider two possibilities:

1.  Use a relational database to store the chat content.  MySQL is
probably the right choice because it offers fast connections (very
important if you're restricted to CGI, which starts a process per
page) and very fast selects.

If you have an attribute 'entered' of type timestamp, you could use
something like:

select content from entry order by entered limit 20;

to get the last 20 chat entries.

You'd need a daemon or cron job to delete old rows.  (By the way, how
are you doing this at present?)  Or put that code in the CGI (adding
to its overhead).

You'd need the DBI and Msql-Mysql modules to talk to your database
from Perl.

2.  Use IPC::Shareable, which lets you share data structures between
processes.  (Disclaimer: I have no experience with it.)  It would be
perfect for your application if you could push and pop a shared array.

Unfortunately, from what I'm reading (Writing Apache Modules with Perl
and C) you probably need to shlock, copy the array, push, shift, copy
back to shared memory, shunlock.  It should still be a lot faster than
file I/O.

I hope I haven't elided too much in the interest of brevity.


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

Date: Fri, 12 Nov 1999 00:20:26 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: function: full(\*FILEHANDLE)
Message-Id: <Pine.GSO.4.10.9911120020090.19132-100000@crusoe.crusoe.net>

On Nov 12, Eric Bohlman blah blah blah:

> : Below is a function that returns the closest full line to your current
> 
> For a rather specialized and potentially misleading definition of
> "closest."  It would be better to describe it as the "next full line
> following your current file position." 

Err, yes.  Point taken. :)

-- 

  MIDN 4/C PINYAN, USNR, NROTCURPI     http://www.pobox.com/~japhy/
  jeff pinyan: japhy@pobox.com     perl stuff: japhy+perl@pobox.com
  "The Art of Perl"               http://www.pobox.com/~japhy/book/      
  CPAN ID: PINYAN  http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
  PerlMonth - An Online Perl Magazine     http://www.perlmonth.com/



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

Date: Fri, 12 Nov 1999 05:51:47 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: Generating pi
Message-Id: <942386239.142481@elaine.drink.com>

In article <slrn82n103.lmh.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:

>        system gunzip => "/tmp/pi$i.dat.gz";
>    print "3.";

>    system "cat /tmp/pi??.dat.gz";

gunzip will strip the .gz extension, so the cat should be of /tmp/pi??.dat


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

Date: Fri, 12 Nov 1999 06:28:27 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Generating pi
Message-Id: <s2ncsbq1hsq20@corp.supernews.com>

revjack (revjack@radix.net) wrote:
: Anybody ever tool up an algorithm in perl to generate the
: digits of pi? I've been searching the web for an hour and no
: dice. Don't see a Math::Pi on CPAN either. Hm.


A way that gets the job done if you have lots of time to kill:

#!/usr/bin/perl -w
# pi - generate N digits of pi using a lousy series
# Useage: pi _N_
# Default for N is 5.  Limit of precision is double representation
# Craig Berry (19991111)

use strict;

my $digits  = shift || 5;
my $dfrac   = $digits - 1;        # Fractional-part digits
my $epsilon = 10 ** (- $digits);  # Eps = 1/10 least sig digit
my $pi      = 0;
my $n       = 0;
my $term;

do {
  $term = 4 / (2 * $n + 1);
  $pi  += ($n++ % 2 ? -1 : 1) * $term;
} while $term > $epsilon;

printf "pi = %.${dfrac}f  ($n terms in series)\n", $pi;

__END__

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: Thu, 11 Nov 1999 23:14:03 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Generating pi
Message-Id: <MPG.12955e0dc9766a4298a1e8@nntp.hpl.hp.com>

In article <s2ncsbq1hsq20@corp.supernews.com> on Fri, 12 Nov 1999 
06:28:27 GMT, Craig Berry <cberry@cinenet.net> says...
> revjack (revjack@radix.net) wrote:
> : Anybody ever tool up an algorithm in perl to generate the
> : digits of pi? I've been searching the web for an hour and no
> : dice. Don't see a Math::Pi on CPAN either. Hm.
> 
> A way that gets the job done if you have lots of time to kill:
> 
> #!/usr/bin/perl -w
> # pi - generate N digits of pi using a lousy series
> # Useage: pi _N_
> # Default for N is 5.  Limit of precision is double representation

A way that gets the job done *fast* if all you want is double precision:

    $pi = 4 * atan2(1, 1);

But *everybody* knows that!  No fun at all.  :-(

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 12 Nov 1999 07:27:52 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Generating pi
Message-Id: <80gfho$ou0$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Yanick Champoux
<yanick@sympatico.ca>],
who wrote in article <5sKW3.47247$Jp4.70650@news20.bellglobal.com>:
> >  perl -MMath::Pari=:prec=100000,Pi -wle "print Pi" 
> 
> 	Drat! Writing that module would have been fun. Oh well.. 
> Maybe I'll have better luck with 'e'. :)

Hmm, e looks harder:

  perl -MMath::Pari=:prec=32000,:int -wle "print exp 1"

took more than 5 min on my machine.

Ilya


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

Date: 12 Nov 1999 04:52:36 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: GURU HELP NEEDED FOR NEWBIE
Message-Id: <382B9CCD.B893A1FB@vpservices.com>

Kragen Sitaker wrote:
> 
> My PERL script doesn't work.  What's wrong?

Not that I am a plagiarist or anything, but, the answer is: 

You have a bug on line 17. 

I suggest you take the three extra caps in PERL and use them to squash
it.  Or you could turn on a bright light in a dark room and see if the
bug flies away.  If neither of those work, come back to this newsgroup
using the same subject line but with a lot of exclamation points on it. 
Real gurus only put out for exclamation points.

-- 
Jeff


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

Date: Fri, 12 Nov 1999 01:28:26 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: GURU HELP NEEDED FOR NEWBIE
Message-Id: <Pine.GSO.4.10.9911120127210.19132-100000@crusoe.crusoe.net>

On Nov 12, Jeff Zucker blah blah blah:

> Kragen Sitaker wrote:
> > 
> > My PERL script doesn't work.  What's wrong?
> 
> I suggest you take the three extra caps in PERL and use them to squash
> it.  Or you could turn on a bright light in a dark room and see if the
> bug flies away.  If neither of those work, come back to this newsgroup
> using the same subject line but with a lot of exclamation points on it. 
> Real gurus only put out for exclamation points.

I can't read the original question, due to the over-abundance of useful
punctuation and proper spelling... If you could run that through
English2AOL, I'd be much more likely to provide assistance.

-- 

  MIDN 4/C PINYAN, USNR, NROTCURPI     http://www.pobox.com/~japhy/
  jeff pinyan: japhy@pobox.com     perl stuff: japhy+perl@pobox.com
  "The Art of Perl"               http://www.pobox.com/~japhy/book/      
  CPAN ID: PINYAN  http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
  PerlMonth - An Online Perl Magazine     http://www.perlmonth.com/



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

Date: Thu, 11 Nov 1999 21:37:35 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Help needed fast please
Message-Id: <MPG.12954778b888ca2198a1e7@nntp.hpl.hp.com>

In article <382b368b@news.amigo.net> on Thu, 11 Nov 1999 20:30:00 -0700, 
Randy Smith <randys@NOSPAMamigo.net> says...
> 
> Chris <chris@chrismail.connectfree.co.uk> wrote in message
> news:382a87d4.0@news2.cluster1.telinco.net...
> : I have made some changes to the help I was last given like putting html in
> : and it dosen't work plus the other file hasn't been helped with the files
> : are below ( I have maked my changes) HELP ME PLEASE!!
> :
> : sign_up.pl ----
> : #########################
> :
> : #!/usr/bin/perl -wT
> :
> : use strict;
> : use CGI qw(:standard);
> : use Fcntl qw(:flock);
> :
> : $ENV{qw(PATH IFS)} = '' x 2;
> Did you forget a " in this line?

Probably supposed to be this:

    @ENV{qw(PATH IFS)} = ("") x 2;

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 12 Nov 1999 01:03:38 -0500
From: dha@panix.com (David H. Adler)
Subject: Re: Help with Stoopid Nutscrape (Netscape)
Message-Id: <slrn82nbdq.7g7.dha@panix.com>

On Fri, 12 Nov 1999 13:41:50 +1300, Andrew Broadley
<expoinfo@globalexpos.co.nz> wrote:

>HTML is fine, ive been doing html longer than perl, but I believe its a
>fault with the perl script I've done. I still dont understand why you need
>to put Context type: text/standard in (even though it is in there)

Well, that's news, as you gave us no actual indication of what you
did.  Did you consider using "Content-Type: text/html\n\n", which
might actually be correct?  Not that I have any idea in what context
you're using "Context type: text/standard".  :-|

Quite frankly, I think you're having trouble with cgi or netscape
itself... not perl.  Perhaps you might wish to take a look at the
(somewhat poorly named) "Idiot's Guide to Solving Perl CGI Problems"
at <http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>.

And, just in case this isn't clear, HTML is not CGI.  Nor is Perl.
Getting clear on what CGI *is* might be a good idea.  Or not,
depending on what you're trying to do.

Good luck.

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"I didn't say I'd never slay another vampire.  It's not like I have
fluffy bunny feelings about them.  I'm just not going to get too
extra-curricular about it."
	- Buffy


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

Date: Fri, 12 Nov 1999 06:12:56 GMT
From: mpm@unix2.megsinet.net (www.www2.internetpros.com)
Subject: Re: Help: Form returns &#8220; instead of " a left double quotation mark, is this unicode issue? MIME issue?
Message-Id: <slrn82nc80.pl0.mpm@unix2.megsinet.net>

In article <8040i7$k79$1@birch.prod.itd.earthlink.net>, Arthur Gibbs wrote:
>When my perl cgi scripts receives a form submission it posts the infomation
>to a HTML file and then sends the results via E-mail.  The HTML looks great.
>However the text e-mail includes unicode characters that my e-mail program
>(outlook express) and others show as symbols.  So instead of "hi", I see
>&#8220;Hi&#8221;
>
>How can I convert those codes into something meaningful in e-mail?  Do I
>need to convert them to ASCII or another charaset?  I don't want an e-mail
>full of &#8220; codes that can't be decoded by text e-mail readers?

Try echoing the "Content-Type" header line to whatever you're using to send
the email (I recommend Net::SMTP, but your script may vary).

  Content-Type: text/plain; charset="us-ascii"

Replace "us-ascii" with some broader character set, like "iso-latin-1" or
"iso-8892" or something.

Alternately, you could build a huge hash table of all the unicode values mapped
to their octal values:

  my %unihash = (
    '&#8218;' => \0130,
    '&#402;'  => \0131,
    '&#8222;' => \0132,
    '&#8230;' => \0133,
    etc. etc.
  );

Then, do something like:

foreach (keys %unihash) {$body_of_email =~ s/$_/$unihash{$_}/gis;}

to substitute the actual character for the unicode notation.

Of course, if the unicodes are being put in by Outlook Express, your
problem's not with the perl script or the email server... :)

>I looked at CPAN and couldn't find these longer 8220 type codes in any of
>the unicode or parser modules?
>
>Any body else dealing with this issue?  I have a table below that I guess is
>what I'm talking about and these characters that need to be converted to
>work in e-mail?

I must confess, I've never had this problem, even with clients that use
Outlook Express for their mail program.  At least not that I've heard from 
them on... Hopefully the above postulations will prove fruitful to your
efforts.

>ALT-0130   &#8218;   ,    Single Low-9 Quotation Mark
>ALT-0131   &#402;    f    Latin Small Letter F With Hook
>ALT-0132   &#8222;   "    Double Low-9 Quotation Mark
>ALT-0133   &#8230;   .    Horizontal Ellipsis
>ALT-0134   &#8224;   ?    Dagger
>ALT-0135   &#8225;   ?    Double Dagger
>ALT-0136   &#710;    ^    Modifier Letter Circumflex Accent
>ALT-0137   &#8240;   ?    Per Mille Sign
>ALT-0138   &#352;    S    Latin Capital Letter S With Caron
>ALT-0139   &#8249;   <    Single Left-Pointing Angle Quotation Mark
>ALT-0140   &#338;    O    Latin Capital Ligature OE
>ALT-0145   &#8216;   '    Left Single Quotation Mark
>ALT-0146   &#8217;   '    Right Single Quotation Mark
>ALT-0147   &#8220;   "    Left Double Quotation Mark
>ALT-0148   &#8221;   "    Right Double Quotation Mark
>ALT-0149   &#8226;   .    Bullet
>ALT-0150   &#8211;   -    En Dash
>ALT-0151   &#8212;   -    Em Dash
>
>Please help via the newsgroup, so all can learn with me.  Thanks in advance
>to the perl gurus of the world!!!
>
>Arthur :)
>

--Mike


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

Date: 11 Nov 1999 23:24:43 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: How to encrypt a web log-in, and work w/accounts in Perl cgi?
Message-Id: <slrn82n9bd.lmh.abigail@alexandra.delanet.com>

Nick (nickysantoro@yahoo.com) wrote on MMCCLXIII September MCMXCIII in
<URL:news:80eu68$2r3$1@agate.berkeley.edu>:
 .. Hello, I was wondering how to create accounts a while ago,

You need a time machine to do things in the past....



Abigail
-- 
perl -e 'for (s??4a75737420616e6f74686572205065726c204861636b65720as?;??;??) 
             {s?(..)s\??qq \?print chr 0x$1 and q ss\??excess}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 11 Nov 1999 23:29:53 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: How to not print Header in my page?
Message-Id: <slrn82n9l7.lmh.abigail@alexandra.delanet.com>

Qinqiang Sun (qsun@kitco.com) wrote on MMCCLXIII September MCMXCIII in
<URL:news:382AE4FC.395708ED@kitco.com>:
,, Hi,
,, I use perl5 building 515 and IIS4.0 on our NT4.0 Server. Run perl script
,, with perlIS.dll. I got the header part I don't want
,, "HTTP/1.0 200 OK Date: Thu, 11 Nov 1999 15:45:47 GMT Server:
,, Microsoft-IIS/4.0 Content-type: text/html ". Please help me to not print
,, this on our page.


Well, duh. If you don't want to print something, don't print it. Djees.



Abigail
-- 
               split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_)  {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 11 Nov 1999 21:39:55 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Jobs Opportunities at CitySearch
Message-Id: <m1ogd0qndg.fsf@halfdome.holdit.com>

>>>>> "Tom" == Tom Briles <sariq@texas.net> writes:

Tom> But where do you see the word 'job' in comp.lang.perl.misc?

Here's what I send to every job posting in every group I frequent
(except .smalltalk, because they seem to want to huddle there :):

    You have posted a job posting or a resume in a technical group.

    Longstanding Usenet tradition dictates that such postings go into
    groups with names that contain "jobs", like "misc.jobs.offered", not
    technical discussion groups like the ones to which you posted.

    Had you read and understood the Usenet user manual posted frequently
    to "news.announce.newusers", you might have already known this. :)

    Please do not explain your posting by saying "but I saw other job
    postings here".  Just because one person jumps off a bridge, doesn't
    mean everyone does.  Those postings are also in error, and I've
    probably already notified them as well.

    If you have questions about this policy, take it up with the news
    administrators in the newsgroup news.admin.misc.

    Just another former Usenet admin (and Usenet user since 1980),

If more of us do that, maybe the clue stick will be appropriate swung.

-- 
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: 12 Nov 1999 00:26:49 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: mySql, DBI, and pop-up menus
Message-Id: <slrn82ncvr.lmh.abigail@alexandra.delanet.com>

Davis Ford (forddavi@pilot.msu.edu) wrote on MMCCLXIII September MCMXCIII
in <URL:news:80fcva$kje$1@msunews.cl.msu.edu>:
!! Hello, I want to create a pop-up menu (drop-down list) html form object
!! where the options for the list will
!! come from a DBI query.
!! 
!! I have tried this code, which did not work:
!! 
!! $stm = $dbh->prepare("SELECT projName FROM project") or die "Unable to
!! prepare sql: $dbh->errstr\n";
!! 
!! then later...
!! 
!! while (my $ref = $stm->fetchrow_arrayref)
!! {
!!         @project = (\"%s\", $$ref[0];
!! }

Well, that's a syntax error... If that's really your code, I'm 
very surprised you actually get anything.

!! then the drop down box (using CGI.pm)
!! 
!! print $q->popup_menu( -name=>'Projects', -values=>\@project, -default=>'
!! ' );
!! 
!! This creates a pop-up menu with an array reference in it.  However, if I do
!! this;
!! 
!! foreach $item( @project ){
!!     print $item;
!! }
!! 
!! It only prints the very first item in what should be a list of 3-4 items.
!! So, I have a couple of problems here...
!! 
!! 1. My code to store the DB results in an array @project only seems to store
!! the first item.

Well, $$ref[0] is the same as $ref -> [0], so you're only asking
for the first item. However, you're doing it some hopelessly wrong,
I've no idea what you want @project to be.



Abigail
-- 
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Thu, 11 Nov 1999 23:51:04 -0800
From: John Iyezack <snapperhead_420NOsnSPAM@hotmail.com.invalid>
Subject: Need help with arrays.
Message-Id: <000b8d9b.77acc8a7@usw-ex0101-004.remarq.com>

I have this array filled with numbers.  I need to be able to go through
the array an take out all of the duplicate entrys and place them into
another array.  Seems strange and simple, but, I can't figure it out!

Example:

array 1:
1
1
2
2
3
1
2
2
1
2
5
3
4
2
1
3
9
8

Array 2 would only have all the number listed once.
1
2
3
5
9
8

I tired using a loop to test each the new array against the contents of
the old one.  But, it is just not working properly.

Can anyone show me an easy way to do this, without me having the hudge
cluster of a 1000 ifs and loops ?
Thanks


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: 12 Nov 1999 00:32:37 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Perl Interpreter in Java
Message-Id: <slrn82ndao.lmh.abigail@alexandra.delanet.com>

Nimrod Shaulski (nimi@sd.co.il) wrote on MMCCLXIII September MCMXCIII in
<URL:news:80em0d$bth$1@news.netvision.net.il>:
:: Hi all.
:: I'm looking for a perl interpreter written on Java (so I can activate
:: scripts from inside my Java application).

There isn't one. perl is a moving target, and it's already hard enough
to maintain what's there. I doubt we'll see jperl anytime soon.

Combine that with the fact that Perl is considered "slow", and Java
isn't on the fast side either...



Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 12 Nov 1999 00:34:47 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Removing leading zeros from a string?
Message-Id: <slrn82ndeq.lmh.abigail@alexandra.delanet.com>

Burt lewis (burt@ici.net) wrote on MMCCLXIII September MCMXCIII in
<URL:news:r5AW3.823$Hp1.52029@ndnws01.ne.mediaone.net>:
%% Hello,
%% 
%% I know how to remove leading and trailing spaces ok
%% for ($string) {
%%             s/^\s+//;
%%             s/\s+$//;
%%         }
%% 
%% But I have a string that looks like this:
%% 00000123456
%% 
%% And I need to remove the leading zeros up to the first non-zero
%% so it looks like this.
%% 123456
%% 
%% I've spent way too much time trying to figure this out.


Well, you know how do remove spaces. If you take the trouble and
read 'man perlre' you also understand *why* it removes spaces.
Once you know that, removing 0's won't be too hard.

Programming is more than cut-and-paste.



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 12 Nov 1999 06:35:10 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Removing occurrences of a string from another string
Message-Id: <s2nd8ueuhsq15@corp.supernews.com>

Duncan Bayne (D.Bayne@NmaOssSeyP.aAc.Mnz) wrote:
: Hi all.  I am a PERL newbie and am trying to remove all occurrences of a
: given string (in this case 'the ') from another string.  So far the best I
: have come up with is:
: 
: $input = join("", split(/the /,$input));
: 
: This seems like an unholy kludge to me though,

Your unholy-kludge detector is working properly.

: and I suspect there is a
: function somewhere that will let me do it in a tidier fashion.

Not a function per se, but an operator.  You'll find it described in
perlop and perlre:

  $input =~ s/\bthe\b//g;

I'm using the word-boundary \b assertions to avoid matching e.g. 'then' or
'bathe' or 'lather' instances of 'the' (which is what I suspect you were
trying to do by including that space in your split regex).  So basically
my line above says "Find each instance of the word 'the' not embedded in
other word characters in $input, and replace it with an empty string".

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: 12 Nov 1999 00:39:07 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Removing occurrences of a string from another string
Message-Id: <slrn82ndmn.lmh.abigail@alexandra.delanet.com>

Duncan Bayne (D.Bayne@NmaOssSeyP.aAc.Mnz) wrote on MMCCLXIV September
MCMXCIII in <URL:news:voJW3.1869$5W2.40312@news.clear.net.nz>:
__ Hi all.  I am a PERL newbie and am trying to remove all occurrences of a
__ given string (in this case 'the ') from another string.  So far the best I
__ have come up with is:
__ 
__ $input = join("", split(/the /,$input));
__ 
__ This seems like an unholy kludge to me though, and I suspect there is a
__ function somewhere that will let me do it in a tidier fashion.  I've had a
__ look through the manpages and the FAQs on this NG and can't find anything
__ though.


Really? You have looked through the manpages and FAQs of Perl, and
you managed to miss to s///? 

That's utterly amazing. What's next, someone reading a book about
Java, and "missing" how to do OO?



Abigail
-- 
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
          for (s;s;s;s;s;s;s;s;s;s;s;s)
              {s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 12 Nov 1999 16:02:10 +1100
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: Senior Software Engineer (Perl)-Positions Available
Message-Id: <bigiain-1211991602100001@bigman.mighty.aust.com>

Eric asked:

> Iain Chalmers (bigiain@mightymedia.com.au) wrote:
> : Tad wrote:
> : >    I dunno what "Word 95-98" might represent...
> : 
> : Well, that'd be Word -3, which (obviously) means Word 1897 :-)
> : 
> : big
> : 
> : (who can't remember if that version came with the lead smelter & moveable
> : type, or the hammer & chisel)
> 
> Why would it have come with either?  Neither was a proprietary Microsoft 
> technology.

Don't you remember? They were trying to "embrace & extend"... When they
started shipping all hammers with innovative screwdriver tips in the faces
though...

big

(wondering just how you'd 'decommodify the hammer protocol"? :-)

-- 
"Beginning at about 72 seconds, a series of events occurred 
 extremely rapidly that terminated the flight."
<http://www.ksc.nasa.gov/shuttle/missions/51-l/mission-51-l.html>


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

Date: 12 Nov 1999 00:50:43 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: sorting withing multiple files
Message-Id: <slrn82necn.lmh.abigail@alexandra.delanet.com>

Steve . (syarbrou@nospam.enteract.com) wrote on MMCCLXIII September
MCMXCIII in <URL:news:382b2cf8.20490426@news.enteract.com>:
'' I have 100's of comma delimited files(all in the same directory and
'' all with the format *******s.log) that the third entry is an IP
'' address.  That's the only field I'm interested in.  I want to see how
'' many unique IP addresses there are in the files.  This is cumulative
'' so if the same IP is in 15 files, that only counts as one.  So
'' basically worst case I would like to loop thru all the files and read
'' the IP's into a massive array and then sort and count when the address
'' changes add one.  Is there a good way to do this?  Thanks.


It's in the FAQ. In fact, all aspects of your problem are.



Abigail
-- 
$_ = "\x3C\x3C\x45\x4F\x54";
print if s/<<EOT/<<EOT/e;
Just another Perl Hacker
EOT


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 12 Nov 1999 15:02:14 +0900
From: Mike Ryan <mryan@kc4.so-net.ne.jp>
Subject: Re: Style Sheets crash netscape
Message-Id: <382BAD66.FD04E883@kc4.so-net.ne.jp>

OK please IGNORE this, I am idiot :)

my html code was

<blockquote>
blaa bla bla
/<blockquote>

doh !
but its interesting to see how netscape handles this combination, try it
our :)
Mike.



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

Date: Fri, 12 Nov 1999 01:18:09 -0500 (EST)
From: KernelKlink@webtv.net
Subject: Re: using the 'Location :' command
Message-Id: <10737-382BB121-50@storefull-214.iap.bryant.webtv.net>

Stuart wrote:
-------------------------------------------
I'm trying to use Perl on my NT4 server to return a Word document to a
user in their web browser and I've came across a little problem. 

I use 
print "Content-type:text/plain\n";
print "Location: $fullpath \n\n"; 

with $fullpath containing 'file://t:\docs\filename.doc' and this works
up to a point. 

The point being that if the filename contains spaces then the browser
(IE5) doesn't display the document. 
Any clues to what I'm doing wrong? ;-)
-------------------------------------------

Stuart,

Are you using these 2 headers in the same script? If so, this could
cause a problem. 

My Perl documentation says that these 2 headers cannot be used together.



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

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 1357
**************************************


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