[10109] in Perl-Users-Digest
Perl-Users Digest, Issue: 3702 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 12 22:07:16 1998
Date: Sat, 12 Sep 98 19:00:18 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 12 Sep 1998 Volume: 8 Number: 3702
Today's topics:
Bug/feature limitation regarding hex numbers. <mgregory@asc.sps.mot.com>
Re: Change NT IP Address Using Perl (Gregory Spath)
Re: Comments on my Code? <rra@stanford.edu>
Easy solution but cant seem to find it??? (MercuryZ)
FWP(free webspace provider)programs/programer needed (PuFF DaDDz)
Re: How to determine if Application is in memory? (Jonathan Stowe)
Re: How to getc like in C? <rmlynch@best.com>
Re: majordomo for perl.moderated? (Jonathan Stowe)
Re: Off topic, but ... [Was Re: Perl & Java - differenc <mpersico@erols.com>
Re: Perl & Java - differences and uses <borg@imaginary.com>
Perl 5.004 upgrade problem <chris@opac.osl.state.or.us>
Perl 5.004_04 seg fault <mkanaley@tibco.com>
Re: Perl Data Structures: trees etc... <mpersico@erols.com>
Re: Perl documentation (David Hawker)
Re: Perl documentation (David Hawker)
Re: Possible Perl memory problem (Jonathan Stowe)
PROGRAMS FOR FWP(free webspace provider)---need program (PuFF DaDDz)
Re: question about regular expr... (Tad McClellan)
Simple Search Script <skyward@frognet.net>
Re: Trouble with Prompt in Telnet Module (Jonathan Stowe)
Re: {{{ Programmer Needed... }}} <sneaker@sneex.fccj.org>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Sep 1998 16:59:44 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Bug/feature limitation regarding hex numbers.
Message-Id: <r8ogsldc0n.fsf@asc.sps.mot.com>
man perldata says:
Scalar value constructors
Numeric literals are specified in any of the customary
floating point or integer formats:
12345
12345.67
.23E-10
0xffff # hex
0377 # octal
4_294_967_296 # underline for legibility
This program:
$a = 0x100000000; # 0xFFFFFFFF +1
print "$a\n";
$a = 4_294_967_296; # 0xFFFFFFFF +1
printf("%f %x\n", $a, $a);
produces this output:
Integer overflow in hex number at /home/mgregory/bin/foo.pl line 1.
0
4294967296.000000 ffffffff
Given that the two representations are mentioned 'in the same breath'
in the documentation, and an integer bigger than 0xFFFFFFFF is
specifically mentioned, it caught us by suprise that this doesn't
work.
Is this a bug? Is is it a limitation that is documented somewhere
else?
We wanted to say $a = 0x100000000; because it is so much clearer what
the number is!
Martin.
------------------------------
Date: 13 Sep 1998 01:40:59 GMT
From: gspath@NOSPAM.epix.net (Gregory Spath)
Subject: Re: Change NT IP Address Using Perl
Message-Id: <z2H2FGLjexoj-pn2-k6rIcfcvjKFx@hobbes.epix.net>
On Sat, 12 Sep 1998 14:29:20, Gellyfish@btinternet.com (Jonathan
Stowe) wrote:
>
> Rexx, Rexx ? I would recommend comp.lang.rexx then buddy. ;-}
>
Hey, now. I'm a perl coder now too, and have converted a bunch of my
REXX stuff (quite easily, I might add)
REXX is still better at some tasks, although I'm liking perl quite a
bit.
(and take a look at the groups you crossposted to in your followup
there, buddy ;-)
-- Greg
------------------------------
Date: 12 Sep 1998 16:20:57 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Comments on my Code?
Message-Id: <yln2843okm.fsf@windlord.stanford.edu>
Jonathan Stowe <Gellyfish@btinternet.com> writes:
> I must admit that I once wrote a Bulk mail script at work for the
> purposes of sending the instructions on how to use the e-mail software
> to all our users after rolling mail out. Of course that was pretty
> logic impaired really wasnt it.
If you're sending mail to local users, it's pretty much always better to
write a script that does local delivery rather than going through an MTA
and then run it on your mail server. It's much less load on your system.
If you're sending bulk mail but *not* to local users, you've got a mailing
list and want to use the various tools already available to run mailing
lists (opening a separate sendmail process for each message is not a good
one).
If you aren't sending mail to local users and you don't have a mailing
list... well, I really can't think of too many other reasons for doing
this that I wouldn't consider spam. But they may exist.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 13 Sep 1998 01:10:00 GMT
From: sf@sf.com (MercuryZ)
Subject: Easy solution but cant seem to find it???
Message-Id: <6tf618$rd7$1@fir.prod.itd.earthlink.net>
I wish to use LYNX to help automate some shareware downloads.
When you are in your telnet shell, and you type:
lynx www.shareware.com/directory/filename.zip
a message will come up asking you to select d for download
or c for cancel. In perl, I am having trouble pressing the
d automatically. In other words, I am able to system "lynx..."
but when the message comes up to select D or C I simply
can't figure out how to get perl to select D or C for me.
Any ideas, pointers, pointers to a reference, would
be appreciated.
If you could email me at mercuryz@sardonia.alabanza.com
I would appreciate it, or if you prefer to post in the
newsgroup that is fine too.
Thanks, Sean
------------------------------
Date: 13 Sep 1998 01:53:33 GMT
From: puffdaddz@aol.com (PuFF DaDDz)
Subject: FWP(free webspace provider)programs/programer needed
Message-Id: <1998091301533300.VAA23692@ladder03.news.aol.com>
OK
I am CEO of a new FWP called Telaweb(free webspace provider)---like goecities
anyways
we need these kind of programs:
a automatic sign up that asks users what kind of page they have so can target
advertising--then send a validate string to the emails address they put---then
to get webspace they need to go to a certain page and validate it
then we need a log in place that includes the following things---file
manager--with all options--edit,create,delete,upload, etc...and users will need
to be able to change pw and delete their accout
also the sign up will need to give ftp/email/webspace--this will be on a linux
server---if interested in joining our company telaweb---contact by
icq---6707316(#) or by email--puffyz@beer.com----
thanx
------------------------------
Date: Sat, 12 Sep 1998 21:16:59 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: How to determine if Application is in memory?
Message-Id: <35fad044.85484061@news.btinternet.com>
On Fri, 11 Sep 1998 20:22:03 GMT, RonBo wrote :
>I'd like to know if anyone has figured out how to determine if a
>specific application or process is currently in memory?
>
>I only have the application name (dsmcsvc.exe) and I don't have the
>PID available to lookup.
>
Of course you could always use taskmgr.exe ;-}
/J\
--
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 12 Sep 1998 14:04:55 -0700
From: Robert Lynch <rmlynch@best.com>
Subject: Re: How to getc like in C?
Message-Id: <35FAE1F7.4CED19D@best.com>
Abbas Imani wrote:
>
> Hi All,
> I am trying to write a menu type of thing for my perl script. I would
> like to have one
> character input without having to hit 'enter' key. In other words I like
> to have something like
> getc in c. The getc command in Perl acts like getchar in C.
> Cheers,
> Abbas
> ________________________________________________________________
> Abbas Imani A.Imani@unsw.edu.au
> Computer Networks Laboratory http://ikorn.ee.unsw.edu.au
> School of Electrical Engineering Phones: 9385-4055, 9385-4070
> UNSW, Sydney NSW 2052 AUSTRALIA Fax: 9385-5993
> ----------------------------------------------------------------
> My programs don't have bugs, they just develope random features.
perldoc -f getc
--
Robert Lynch-Berkeley CA USA-rmlynch@best.com
http://www.best.com/~rmlynch/
------------------------------
Date: Sat, 12 Sep 1998 21:16:54 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: majordomo for perl.moderated?
Message-Id: <35faca68.83983455@news.btinternet.com>
On Sat, 12 Sep 1998 09:57:26 -0700, Dale Phillips wrote :
>Does a majordomo exit for this news group?
>I would prefer the moderated one if possible.
>
No this is a newsgroup not a mailing list. However the newsgroup is
archived by DejaNews at <URL:http://www.dejanews.com/> and sundry
other sites.
Having said that it might be possible that an e-mail gateway for the
group exists of whose existence I am ignorant.
/J\
--
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 12 Sep 1998 21:47:43 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: Off topic, but ... [Was Re: Perl & Java - differences and uses]
Message-Id: <35FB243F.F500E77D@erols.com>
No Jim, your most important DMZ is the Channel!
Jim Brewer wrote:
>
> Hey, what about the Atlantic Ocean. That's a REAL DMZ. Shielding us
> from North America. Funny that. Big, cold, deep. Perfect.:)
--
#!/usr/bin/perl -- Matthew O. Persico
print "Just Another Perl Neophyte\n";
## Simplicity is a blessing when you're
## supporting the program at 2AM
------------------------------
Date: Sat, 12 Sep 1998 22:43:08 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <0OCK1.1150$E9.4125173@ptah.visi.com>
In comp.lang.java.programmer David Formosa <dformosa@zeta.org.au> wrote:
: In <LNeK1.958$E9.3226998@ptah.visi.com> George Reese <borg@imaginary.com> writes:
:>In comp.lang.java.programmer Matt Knecht <hex@voicenet.com> wrote:
: [...]
:>: To maintain it, though, you did need a good understanding of the
:>: language. Without that, forget it.
:>C is hard to maintain beyond memory issues (and perl still has memory
:>issues, as does python or Java--just with perl it takes more talent to
:>construct your apps so that the memory issues are not so important).
: How do you get a segfualt or a memory leek from within Perl? In C
: you just have to sneeze and you end up pointing to invalid memory.
: But in perl there is no way due to the nature of the language to cause this
: to occour.
That's not the only memory issue. You also have to make sure you are
not allocating a ton of memory and retaining references to it without
nulling those references.
:>To your objection that computers are complex I have to laugh.
:>Computer languages are infinitely simpler than human languages. They
:>are designed to enable a human to express their desires in a format
:>understandable by simple minded computers--yes, computers are very
:>simple minded, they are not at all complex.
: But I don't wish to express simple idears, I wish to express quite
: complex idears. So it seems natural that I should use a languge that
: mirrors that complextity.
You are not hearing me.
Programming languages--ALL OF THEM--are simpler than spoken language.
A programming language does not need to be complex in order to express
complex ideas.
:>It applies bizarre meanings to things that have very different
:>meanings in other contexts.
: So do natural languges. But while thay are infinitely inconsitent that
: are what you would expect.
What is your point here? I think you need to reread what I wrote.
:> Furthermore, perl enables about a million different ways of doing the
:>very same thing.
: Since peaple can never aggry on which is the best way to do something,
: why should we forcably limmit them to one model or anthour?
That is a fallacy.
--
George Reese (borg@imaginary.com) http://www.imaginary.com/~borg
PGP Key: http://www.imaginary.com/servlet/Finger?user=borg&verbose=yes
"Keep Ted Turner and his goddamned Crayolas away from my movie."
-Orson Welles
------------------------------
Date: Sun, 13 Sep 1998 00:51:10 GMT
From: Christopher Adams <chris@opac.osl.state.or.us>
Subject: Perl 5.004 upgrade problem
Message-Id: <35FB16F2.75A7927B@opac.osl.state.or.us>
I am trying to upgrade Perl 5.001 to 5.004. I have never installed Perl
before. Here is what I did:
rm -f config.sh
sh Configure -Dcc=gcc
make
make test
make install
During 'make', I began to get some error messages, that follow:
I/usr/gnu/include -I/opt/gnu/include -O
util.c: In function `Perl_form':
util.c:1107: number of arguments doesn't match prototype
proto.h:125: prototype declaration
util.c: In function `Perl_die':
util.c:1164: number of arguments doesn't match prototype
proto.h:70: prototype declaration
util.c: In function `Perl_croak':
util.c:1231: argument `pat' doesn't match prototype
proto.h:47: prototype declaration
util.c:1231: number of arguments doesn't match prototype
proto.h:47: prototype declaration
util.c: In function `Perl_warn':
util.c:1288: number of arguments doesn't match prototype
proto.h:529: prototype declaration
util.c: In function `Perl_my_popen':
util.c:1818: warning: return makes pointer from integer without a cast
make: *** [util.o] Error 1
<root@elmo:/usr1/oruls/perl/perl5.004_04:1710>$
Since I don't have a clue what to do next, can someone point me in the
right direction? I might need to provide more information, so please let
me know what you need. Thank you.
--
Christopher Adams
cadams@teleport.com
------------------------------
Date: Sat, 12 Sep 1998 17:49:00 -0700
From: mike <mkanaley@tibco.com>
Subject: Perl 5.004_04 seg fault
Message-Id: <35FB167C.394DEEB6@tibco.com>
The following two lines will seg fault Perl.
Make sure the $line_buffer scalar is all on one line
(it is probably split by my email package).
Anybody know a workaround?
Mike Kanaley
TIBCO Inc.
$line_buffer = '<a
href=http://www.wired.com/news/news/business/story/13525.html">Brazil\'s
Telco Samba</a></b><i><font color="#FF0000"><br> 8 Jul 1998
</i></font><br><br> <font face="Verdana, Arial, Helvetica, sans-serif"
size="1"><b><a
href="http://www.wired.com/news/news/politics/story/13349.html">US Urges
China Net Freedom</a></b><i><font color="#FF0000"><br> 30 Jun 1998
</i></font><br><br> <font face="Verdana, Arial, Helvetica, sans-serif"
size="1"><b><a
href="http://www.wired.com/news/news/business/story/12191.html">Copyright
Leads US Exports</a></b><i><font color="#FF0000"><br> 8 May 1998
</i></font><br><br> <font face="Verdana, Arial, Helvetica, sans-serif"
size="1"><b><a
href="http://wired.com/news/news/business/story/12125.html">Good for
Gates, Good for America</a></b><i><font color="#FF0000"><br> 5 May 1998
</i></font><br><br> <font face="Verdana, Arial, Helvetica, sans-serif"
size="1"><b><a
href="http://wired.com/news/news/business/story/11864.html">AOL Takes a
New Euro Spin</a></b><i><font color="#FF0000"><br> 23 Apr 1998
</i></font><br><br> <font face="Verdana, Arial, Helvetica, sans-serif"
size="1"><b><a
href="http://wired.com/news/news/business/story/11669.html">New Economy:
Silicon Wadi</a></b><i><font color="#FF0000"><br> 16 Apr 1998
</i></font><br><br> <font face="Verdana, Arial, Helvetica, sans-serif"
size="1"><font color="#FF0000">Special report: </font><br> <b><a
href="http://www.wired.com/news/news/hongkong/">Hong Kong in
Transition</a></b><i><font color="#FF0000"><br> 12-27 Jun 1997
</i></font><br><br> </td> </tr> <tr> <td> </td> <td
bgcolor="#CCFFCC"> </td> <td bgcolor="#CCFFCC"> <font
face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FF3300">
<b> Commentary from HotWired </b> </font> </td> </tr> <tr>
<td> </td> <td bgcolor="#FFFFCC"> </td> <td bgcolor="#FFFFCC">
<font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><a
href="http://www.hotwired.com/braintennis/96/53/index0a.html">A global
economy: Feast or famine?</a></b><br>David Korten and Steve Gibson
debate.<i><font color="#FF0000"><br> Dec 1996 </i></font><br><br>
<font face="Verdana, Arial, Helvetica, sans-serif"
size="1"><b></b><i><font color="#FF0000"></i></font><br><br> </td>
</tr> <tr> <td><img src="/images/spacer.gif" width="10"
height="1"></td> <td><img src="/images/spacer.gif" width="10"
height="1"></td> <td><img src="/images/spacer.gif" width="130"
height="12"></td> </tr> </table> <br> <font face="Arial,
Helvetica, sans-serif" size=4> <b> Art And Corruption </b> </font> <br>
<font face="verdana, helvetica, arial, sans-serif" size="2"> <a
href="/collections/global_economy/6.01_st_petersburg1.html">Bruce
Sterling, in</a> Saint Petersburg, on what\'s really going on in Russia.
<br> By Bruce Sterling <br> </font> <font face="Verdana, Arial,
Helvetica, sans-serif" color="#FF3300" SIZE="2">Wired 6.01, Jan 1998
</font> <br> <br> <br> <font face="Arial, Helvetica, sans-serif"
size=4> <b> The Long Boom: A History of the Future, 1980 - 2020 </b>
</font> <br> <font face="verdana, helvetica, arial, sans-serif"
size="2"> <a
href="/collections/global_economy/5.07_long_boom1.html">We\'re facing
25</a> years of prosperity, freedom, and a better environment for the
whole world. You got a problem with that? <br> By Peter Schwartz and
Peter Leyden <br> </font> <font face="Verdana, Arial, Helvetica,
sans-serif" color="#FF3300" SIZE="2">Wired 5.07, Jul 1997 </font> <br>
<br> <br> <font face="Arial, Helvetica, sans-serif" size=4> <b>
Thinking Big </b> </font> <br> <font face="verdana, helvetica, arial,
sans-serif" size="2"> <a
href="/collections/global_economy/5.08_malaysia1.html">Are tax
holidays,</a> open immigration for infoworkers, a promise of no Internet
censorship and one man\'s sheer will enough to turn a stretch of
Malaysian jungle into a futuristic, fibered, 30-mile-long technopolis?
<br> By Jeff Greenwald <br> </font> <font face="Verdana, Arial,
Helvetica, sans-serif" color="#FF3300" SIZE="2">Wired 5.08, Aug 1997
</font> <br> <br> <br> <font face="Arial, Helvetica, sans-serif"
size=4> <b> The Bucklands Boys and Other Tales of the ATM </b> </font>
<br> <font face="verdana, helvetica, arial, sans-serif" size="2"> <a
href="/collections/global_economy/1.05_atm_scam1.html">A slick
rip-off</a> begs the question: Can you trust that latent hunk of
cash-dispensing steel? <br> By Phil Patton <br> </font> <font
face="Verdana, Arial, Helvetica, sans-serif" color="#FF3300"
SIZE="2">Wired 1.05, Nov 1993 </font> <br> <br> <br> <font
face="Arial, Helvetica, sans-serif" size=4> <b> New Rules for the New
Economy </b> </font> <br> <font face="verdana, helvetica, arial,
sans-serif" size="2"> <a
href="/collections/global_economy/5.09_new_economy1.html">Twelve
dependable principles</a> for thriving in a turbulent world <br> By
Kevin Kelly <br> </font> <font face="Verdana, Arial, Helvetica,
sans-serif" color="#FF3300" SIZE="2">Wired 5.09, Sep 1997 </font> <br>
<br> <br> <font face="Arial, Helvetica, sans-serif" size=4> <b> The
Relentless Contrarian </b> </font> <br> <font face="verdana, helvetica,
arial, sans-serif" size="2"> <a
href="/collections/global_economy/4.08_peter_drucker1.html">At 86,
Peter</a> Drucker remains the most astute observer of modern corporate
society. Maybe society, period. <br> By Peter Schwartz: Kevin Kelly <br>
</font> <font face="Verdana, Arial, Helvetica, sans-serif"
color="#FF3300" SIZE="2">Wired 4.08, Aug 1996 </font> <br> <br> <br>
<font face="Arial, Helvetica, sans-serif" size=4>';
$line_buffer =~ /^\<[^!\/]([^"\>]|"[^"]*")*\>/;
------------------------------
Date: Sat, 12 Sep 1998 21:51:53 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Perl Data Structures: trees etc...
Message-Id: <35FB2539.B9CF326@erols.com>
The better question to ask is, "Here's my problem, how do I solve it?"
There are many more powerful, higher-level constructs in Perl that
these. If we know the problem, we may be able to offer a better
solution.
John-Paul Arp wrote:
>
> Where could I find information on how to make linked lists and trees in
> Perl? Does Perl even have pointers?
>
> John-Paul
--
#!/usr/bin/perl -- Matthew O. Persico
print "Just Another Perl Neophyte\n";
## Simplicity is a blessing when you're
## supporting the program at 2AM
------------------------------
Date: Sat, 12 Sep 1998 22:51:34 GMT
From: dhawker@removethis.bigfoot.com (David Hawker)
Subject: Re: Perl documentation
Message-Id: <3603e96f.20299052@news.cableol.net>
On Fri, 04 Sep 1998 10:58:15 -0500, fl_aggie@thepentagon.com (I R A Aggie)
felt the need to post:
>In article <35f70381.20857333@news.cableol.net>,
>david.hawker@removethis.cableol.co.uk wrote:
>
>+ On Sun, 30 Aug 1998 01:10:19 GMT, sowmaster@juicepigs.com (Bob Trieger)
>+ felt the need to post:
>
>+ >Who cares if it screws up everyone elses postal service as well as
>+ >yours? You will get less junk mail.
>
>+ If this is an attack on corrupting the email address when posting to usenet
>+ - it can't take a genius to figure out you need to remove the bit that says
>+ "removethis"
>
>Ummm...because some people will send an email response without checking
>first?
Then they get the bounce and realise what they need to do.
>You're just cost shifting your spam fighting to other people. The same
>thing spammers do, ironically.
Whatever!
--
dhawker@bigfoot.com | ICQ 7222349
http://dhawker.home.ml.org
------------------------------
Date: Sat, 12 Sep 1998 22:51:40 GMT
From: dhawker@removethis.bigfoot.com (David Hawker)
Subject: Re: Perl documentation
Message-Id: <3600e7f4.19920444@news.cableol.net>
I find I get a lot more spam when I don't corrupt it.
And the spam I get when it's corrupted, I send fake bounces to.
On Tue, 8 Sep 1998 19:30:53 -0500, tadmc@metronet.com (Tad McClellan) felt
the need to post:
>David Hawker (dhawker@removethis.bigfoot.com) felt the need to post :
>
>: If this is an attack on corrupting the email address when posting to usenet
>: - it can't take a genius to figure out you need to remove the bit that says
>: "removethis"
>
>
> Right.
>
> No genius needed.
>
> A trivially simple program can strip the string 'removethis'
> every time it sees it near at '@' sign.
>
> Even an address harvester has to be not-clever-at-all to
> undo that munging...
>
>
>
> So what is the purpose of putting it in there again?
>
>
--
dhawker@bigfoot.com | ICQ 7222349
http://dhawker.home.ml.org
------------------------------
Date: Sat, 12 Sep 1998 21:16:57 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Possible Perl memory problem
Message-Id: <35faccd7.84606305@news.btinternet.com>
On 12 Sep 1998 02:26:27 GMT, Mark Manning wrote :
>This is a MAYBE posting. That is to say that I believe I may have found
>something wrong with Perl - but it is more likely that I am just doing
>something wrong.
>
>First, the program:
>
>#!/usr/local/bin/perl
>#
># Get the file
>#
> open( THEFILE, "myfile.dat" ) || die $!;
> @oldInfo = <THEFILE>;
> close( THEFILE );
>
> @theInfo = sort @oldInfo;
> undef @oldInfo;
>#
># Remove duplicates
>#
> $i = $#theInfo;
> while( $i > 0 ){
> while( $theInfo[$i] eq $theInfo[$i-1] ){
> splice( @theInfo, $i, 1 );
> }
>
> $i--;
> }
>#
># Remove blank lines
>#
> for( $i=0; $i<=$#theInfo; $i++ ){
> if( length($theInfo[$i]) < 5 ){
> splice( @theInfo, $i, 1 );
> }
> }
>#
># Write everything back out.
>#
> open( THEFILE, ">myfile.dat" ) || die $!;
> print THEFILE @theInfo;
> close( THEFILE );
>
> exit( 0 );
>#
>#####################################################
>
>Ok, here is what the data is like: It is 60,000,000 bytes or 60MB of
>information. Each line is approximately 100-200 characters long. What
>happens is that memory is used up, the program core dumps, and that's all.
>
It is possible that the amount of data you describe could prove to be
too much when handled as per your code.
It might behove you to make a test version of your code that does:
open( THEFILE, "myfile.dat" ) || die $!;
while (<THEFILE>)
{
print $amount += length($_),"\n";
push @oldInfo,$_;
}
close( THEFILE );
to see if it is the reading in of the data that causes the problem.
You have to bear in mind that you are making at least two copies of
your data into @oldinfo and @theinfo and manipulating the data therein
so given the amount of memory you have available you might have some
problems.
/J\
--
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 12 Sep 1998 23:07:17 GMT
From: puffdaddz@aol.com (PuFF DaDDz)
Subject: PROGRAMS FOR FWP(free webspace provider)---need programer or programs
Message-Id: <1998091223071700.TAA29413@ladder03.news.aol.com>
OK
I am CEO of a new FWP called Telaweb(free webspace provider)---like goecities
anyways
we need these kind of programs:
a automatic sign up that asks users what kind of page they have so can target
advertising--then send a validate string to the emails address they put---then
to get webspace they need to go to a certain page and validate it
then we need a log in place that includes the following things---file
manager--with all options--edit,create,delete,upload, etc...and users will need
to be able to change pw and delete their accout
also the sign up will need to give ftp/email/webspace--this will be on a linux
server---if interested in joining our company telaweb---contact by
icq---6707316(#) or by email--puffyz@beer.com----
thanx
------------------------------
Date: Sat, 12 Sep 1998 16:23:23 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: question about regular expr...
Message-Id: <booet6.ik3.ln@metronet.com>
GEMINI (dennis@info4.csie.nctu.edu.tw) wrote:
: could anybody tell me how to express
: "any semicolumn ';' that doesn't enclosed by { and }" in
: regular expression?
You might have a look at Perl FAQ, part 4:
"How can I split a [character] delimited string except when inside
[character]? (Comma-separated files)"
Though your case is slightly different (it used different characters
for start and end, the FAQ example uses double quotes at both ends)
: for eg.
: in string $_="field1;field2;{ ex1; ex2; };field3"
: I want to split the string into array
: ('field1','field2','{ ex1; ex2; }','field3')
: so how should I use split(/????/) for this purpose?
Are fields allowed to be empty? ( m/;;/ )
Are fields allowed to have an opening brace without a matching
closing one?
Are fields allowed to have backwacked curly braces? { foo\};bar; }
This works for your one example, but not if any of the above
are true:
@parts = grep defined && length > 0, split /({[^}]*})|;/, $_;
Or, modifying the FAQ code to your situation (and making it
less robust in the process):
--------------------------
#!/usr/bin/perl -w
$text = 'field1;field2;{ ex1; ex2; };field3';
@new = ();
push(@new, $+) while $text =~ m{
({[^\}]*});? # groups the phrase inside the curly braces
| ([^;]+);?
| ;
}gx;
foreach (@new) {
print "==>$_<==\n";
}
--------------------------
That should give you a good start on it anyway.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 12 Sep 1998 20:26:49 -0400
From: "Skyward" <skyward@frognet.net>
Subject: Simple Search Script
Message-Id: <6tf38j$d8p$1@supernews.com>
Hello,
I am trying to search a flat text file pipe delimited. It can have several
lines for each search parameter. (The user clicks on a image map and I pass
the key in the URL)
I can get the thing to work for one line, but what am I missing to get it to
return multiple lines? Below is the code.
Thanks,
Dave
#! /usr/local/bin/perl
use CGI;
$query = new CGI;
open (FH, "info/info.dat");
@content = <FH>;
close(FH);
$content = join('',@content);
$key = $query->param('county');
$content =~ /\n?${key}.*\n/;
$match = $&;
$match =~ s/\n//g;
@fields = split(/\|/, $match);
foreach ($match)
{
$county = $fields[0];
$type = $fields[1];
$agency = $fields[2];
$address = $fields[3];
$city = $fields[4];
$zip = $fields[5];
$phone = $fields[6];
$fax = $fields[7];
$contactname = $fields[8];
$HTML .=qq*
<br>
Type of agency: $type<br>
Agency Name: $agency<br>
Address: $address<br>
City: $city, State: OH Zip
Code: $zip<br>
Phone: $phone FAX: $fax<br>
Contact Name: $contactname
<br>
<hr>
<br>*;
}
print "Content-type: text/html\n\n";
print<<HTML;
<html>
<head>
<title>Ohio Adoption Advocates - Local Resources</title>
</head>
<body background="../../images/adoptbac.gif" bgcolor="white" text="purple">
$HTML
</body>
</html>
HTML
exit;
------------------------------
Date: Sat, 12 Sep 1998 21:16:55 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Trouble with Prompt in Telnet Module
Message-Id: <35facb44.84203265@news.btinternet.com>
On 12 Sep 1998 17:45:34 GMT, Danny Aldham wrote :
>X-Newsreader: TIN [version 1.2 PL2]
>
>I am using the Net::Telnet module to login to a NT box running the
>telnet deamon. I am using the Input_log to see that the login process
>_is_ working, but I am getting an error that the program is timing out
>waiting for a command prompt. The actual prompt after logging in is:
> C:\WINNT\system32>
>so I think the problem is how I am putting that into the Prompt => line.
>The complete program is below. Any help appreciated.
>
>
>#!/usr/bin/perl -w
>use Net::Telnet() ;
>$bonham = new Net::Telnet (Host => "bonham" , timeout => 30,
> Input_log => "/tmp/input.log" ,
> Prompt => '/[$%C:\WINNT\system32>] $/ ' ) ;
>$bonham -> login("administrator","password") ;
>sleep 2 ;
>@lines = $bonham -> cmd("ls") ;
>print "Got @lines ";
>$bonham -> close ;
>
My understanding was that the prompt that you supplied was the one to
which you gave your login name and password. Not having Net::Telnet
installed here puts me at a bit of a disadvantage though. Anyhow the
MS telnet service is dead ropey to say the least and should be avoided
at all costs for all but the least critical purposes - Of course you
may be using a 3rd party telnet of which I have no opinion.
/J\
--
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 12 Sep 1998 19:45:31 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: {{{ Programmer Needed... }}}
Message-Id: <35FB079B.8CD37721@sneex.fccj.org>
Harley James - Image, Inc. wrote:
>
<snip long dissertation>
> We have been led to believe by programmers who are too busy to
> take the project that it can be done rather simply. I will leave that
> determination up to you experts here.
I disagree with that. Nothing is as simple as a client makes it.
PS - Post here, read here. You didn't say what the pay scale was...
2Cents
-Sneex- :]
__________________________________________________________________
Bill Jones | FCCJ Webmaster | http://webmaster.fccj.org/Webmaster
__________________________________________________________________
We are the CLPM... Lower your standards and surrender your code...
We will add your biological and technological distinctiveness to
our own... Your thoughts will adapt to service us...
...Resistance is futile...
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 3702
**************************************