[8071] in Perl-Users-Digest
Perl-Users Digest, Issue: 1690 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 21 08:17:25 1998
Date: Wed, 21 Jan 98 05:00:39 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 21 Jan 1998 Volume: 8 Number: 1690
Today's topics:
Re: A 'Two Byte Integer' Problem (Bart Lateur)
Byte Ordering using Perl biju@mindless.com
Re: CLS in Perl??? <qdtcall@esb.ericsson.se>
Re: Directory Listing... <abb37@dial.pipex.com>
extract username from basic protection scheme <mikihasa@worldnet.att.net>
Re: extract username from basic protection scheme <xxTony.Curtis@vcpc.univie.ac.at>
Re: FAQ too big (Was: Re: PERL forking) (Bart Lateur)
Freidl's book mystery (Vladimir Sovetov)
Re: grabbing email adresses from webpages (Bart Lateur)
gripe about tied arrays <yary@apicom.com>
HTTP debugger. Does that exist? <craig@skybound.demon.nl>
Java + Perl (Lennie Jarratt)
Re: Oraperl and long type <reccmo@sc03.sctp.dk>
Re: Oraperl and long type <reccmo@sc03.sctp.dk>
Re: Oraperl and long type (M.J.T. Guy)
Outlook 97 and perl scripts <tony.arnold@mcc.ac.uk>
perl - ms sql (Robert Lubej)
perl equivalent of stty...? (Michael J. Maravillo)
Re: perl for NT <pvhp@forte.com>
Re: perl for NT (Jim Michael)
Re: Problems with DBFile (Paul Marquess)
Programmers Wanted (Ari Burton, President of IMARI STUDIOS)
Read/Write problem - Need Help <thestaff@ewbooks.com>
Re: Read/Write problem - Need Help (Michael Budash)
Re: readdir problem <qdtcall@esb.ericsson.se>
Re: readdir problem (Bart Lateur)
Running Two Scripts at Once (Schreffman)
Re: source into binary code tobez@plab.ku.dk
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 Jan 1998 10:59:03 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: A 'Two Byte Integer' Problem
Message-Id: <34cdcec1.9618411@news.tornado.be>
"V. Chandrasekhar" <vchandra@mail.delcoelect.com> wrote:
>2. I want to store numbers guaranteed to be in the
>-32768 to 32767 range, as a 16 bit hex number
>(i.e., Hex 8000 to 7FFF)
substr(sprintf("%04X",$number),-4)
HTH,
Bart.
------------------------------
Date: Wed, 21 Jan 1998 05:32:19 -0600
From: biju@mindless.com
Subject: Byte Ordering using Perl
Message-Id: <885381360.633667585@dejanews.com>
Hi friends,
I have a problem of byte ordering on NT using Perl.
I want to swap the bytes.i.e
I extracted a unsigned integer from a binary file. The result was
$value = 0x09c80000.
Now what i want is 0x000009c8. I have tried the following routine to
swap
$value = ($value >> 24) | ($value) & 0xff00 |
($value << 8) & 0xff0000 | ($value << 24) ;
But end result is
$value = 0xffffffc8
I have ensured that $value is of type unsigned.
The syntax followed for extracting the value $value before swapping is
correct, since the result is as expected.
Is there is any efficient way of swapping the bytes on NT using Perl.
Thanks in advance,
With regards,
Biju
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 21 Jan 1998 11:32:29 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: CLS in Perl???
Message-Id: <iswwfu6rsy.fsf@godzilla.kiere.ericsson.se>
"Daivd Mohorn" <david.mohorn@norfolkva.ncr.com> writes:
> Does Perl-5 have a Clear Screen function or the like? I'm trying to
> display a menu and have to use a bunch of linefeeds to clear screen right
> now....
As far as a Perl script knows, it might be talking to one of thousands
of varieties of terminal connected to a Unix system, one of those
terminals connected to a VMS system, an X-windows display, an MS
Windows display, a plain MS-DOS console, a Linux console, a MacOS
display, an OS/2 display, and probably lots of other stuff I can't
remember offhand. Even defining what "clear the screen" _means_ on all
of those is nontrivial, much less implementing it. In short, no, Perl
does not have "a clear screen function".
Find out what OS you're running under and what display device your
script is talking to, then figure out how to clear that. Then,
implement the clearing method in Perl.
If you're using something even vaguely common, there's probably a
module on CPAN that will help you.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: 21 Jan 1998 09:05:15 GMT
From: "David Reid" <abb37@dial.pipex.com>
Subject: Re: Directory Listing...
Message-Id: <01bd264b$af5492c0$03f682c1@gateway>
Thanks... Will have a look.
As always - a great source of help :-)
brian d foy <comdog@computerdog.com> wrote in article
<comdog-ya02408000R2001982011010001@news.panix.com>...
> In article <01bd2601$49079b60$59f682c1@gateway>, "David Reid"
<abb37@dial.pipex.com> posted:
>
> >Hi. I need to capture a directory listing so I can mess with the files
> >(move them after sorting and cataloguing them) and would like to do it
with
> >a perl script.
>
> see opendir() and friends in the perlfunc man page.
>
> --
> brian d foy <comdog@computerdog.com>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
> Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
>
------------------------------
Date: Wed, 21 Jan 1998 06:11:46 -0500
From: "Michael R. Harper" <mikihasa@worldnet.att.net>
Subject: extract username from basic protection scheme
Message-Id: <6a4kql$smr@bgtnsc01.worldnet.att.net>
I would like to be able to extract the User Name from the dialog box
that gets presented to the user when trying to access a directory
protected by the basic protection scheme (.htaccess, .htpasswd,
WWW-Authenticate, 401 Unauthorized, etc.) using a web browser.
Any ideas? Where do I start?
Michael R. Harper
mikihasa@worldnet.att.net
------------------------------
Date: 21 Jan 1998 12:24:41 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
To: mikihasa@worldnet.att.net
Subject: Re: extract username from basic protection scheme
Message-Id: <7xwwfuvzly.fsf@beavis.vcpc.univie.ac.at>
Re: extract username from basic protection scheme, Michael
<mikihasa@worldnet.att.net> said:
Michael> I would like to be able to extract the User Name
Michael> from the dialog box that gets presented to the user
Michael> when trying to access a directory protected by the
Michael> basic protection scheme (.htaccess, .htpasswd,
Michael> WWW-Authenticate, 401 Unauthorized, etc.) using a
Michael> web browser.
Go to http://www.w3.org/ and look at the HTTP specification
section e.g.
http://www.w3.org/Protocols/rfc2068/rfc2068
which expains the basic authentication scheme.
hth,
tony
------------------------------
Date: Wed, 21 Jan 1998 10:58:52 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: FAQ too big (Was: Re: PERL forking)
Message-Id: <34cbccc2.9107443@news.tornado.be>
"Kevin Hawley" <cbpkxh@arcochem.com> wrote:
>I don't have 40 years to read the FAQ.
>> On Mon, 19 Jan 1998, ARCO Chemical Company wrote:
>>
>> > P.S. The Perl FAQ is TOO big!!
Hmmm... What I think is lacking, is an overview of everything that is
covered in the FAQ. A TOC, a list with ALL the questions and where the
answers can be found.
Not everybody uses Unix, where you can use grep to look it up for you...
On a PC, you have to (manually) open and search through 9 documents.
Bart.
------------------------------
Date: 21 Jan 1998 11:31:40 GMT
From: sova@kpbank.ru (Vladimir Sovetov)
Subject: Freidl's book mystery
Message-Id: <6a4mas$she$1@home.kpbank.ru>
Please, is anyone here kind enough to explain to me what Mr. Friedl is
trying to make me understand when he spend thousands of words
on C /* ... */ comments problem (pp. 168-173)?
Why all the fuss? It seems that regex as obvious as m{/\*(.*?)\*/}
could make the trick. What the sense in lenghty discussion and
the monster like this m{/\*([^*]|\*+[^/*])*\*+/} as a result.
After all my -Dr check
%cat test.pl
!/usr/local/bin/perl -w -Dr
$it = '/***** This *is* / */ hhhh() /* my comment /**/';
print "$it\n";
print "()=:$1:\n" if $it =~ m{/\*(.*?)\*/};
print "()=:$1:\n" if $it =~ m{/\*(([^*]|\*+[^/*])*)\*/};
showed that the last is rather worst than the simple first in terms of
efficency.
What's wrong with my perception?-)) Thank you in advance.
--
Vladimir Sovetov
------------------------------
Date: Wed, 21 Jan 1998 10:58:58 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: grabbing email adresses from webpages
Message-Id: <34ccce1b.9452372@news.tornado.be>
Pascal Hos <paashaas@rice.edu> wrote:
>Subject: grabbing email adresses from webpages
spammer alert! :-)
Bart.
------------------------------
Date: Wed, 21 Jan 1998 00:54:18 -0800
From: Yary <yary@apicom.com>
Subject: gripe about tied arrays
Message-Id: <34C5B7BA.4C97@apicom.com>
I just spent a little while coding up a tied array to see if it
worked well enough for what I was doing. It didn't, which is all
well and good considering all the warnings in the docs about it
being incomplete. But it's pretty inconsiderate for perl 5.004_04
not to warn me that I'm doing unsupported things with a tied array,
even with the -w flag on.
(and why is print join(":",@tied_array) so wrong?)
-y
------------------------------
Date: Wed, 21 Jan 1998 13:23:01 +0100
From: Craig <craig@skybound.demon.nl>
Subject: HTTP debugger. Does that exist?
Message-Id: <34C5E8A5.26FA@skybound.demon.nl>
Hi,
I'm looking for a program to view all the HTTP communication between my
browser and my server to see what my CGI scripts and browser are really
doing. Does something like that exist?
Greetings,
Craig.
------------------------------
Date: Wed, 21 Jan 1998 12:06:47 GMT
From: ljarratt@3mc.com (Lennie Jarratt)
Subject: Java + Perl
Message-Id: <6a4o8a$b1t@camel20.mindspring.com>
I know from O'reilly that there is a Java Perl interface. It comes
with their Perl Resource Kit. Is it available on CPAN yet or where
can it be found?
Thanks,
Lennie
------------------------------
Date: 21 Jan 1998 08:51:00 GMT
From: Christian Mondrup <reccmo@sc03.sctp.dk>
Subject: Re: Oraperl and long type
Message-Id: <6a4ctk$dfe$2@news.net.uni-c.dk>
Monica Fernandez Barreiro <monica@enol.tid.es> wrote:
: Hello:
: I have a problem when I try to insert a variable long type
: in the data base. In a exactly way I'm going to write the
: code and the place where it doesn't work:
: $txt = "insert into cuerpo_certificados
: (email_mayusculas, codigo) values
: ('$email_upper', :1)";
Try
$txt = "insert into cuerpo_certificados
(email_mayusculas, codigo) values
(\'$email_upper\x', :1)";
: $csr = &ora_open ($lda, $txt) || return (1, $ora_errstr);
: &ora_bind($csr, $certificado);
: do ora_close($csr) || return (1, $ora_errstr);
: When the system tries to run the ora_bind it becames stoped and
: useless to do anything.
: That's all.
--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Christian Mondrup, Computer Programmer +
+ Scandiatransplant, Skejby Hospital, University Hospital of Aarhus +
+ Brendstrupgaardsvej, DK 8200 Aarhus N, Denmark +
+ Phone: +45 89 49 53 01, Telefax: +45 89 49 60 07 +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------
Date: 21 Jan 1998 08:57:44 GMT
From: Christian Mondrup <reccmo@sc03.sctp.dk>
Subject: Re: Oraperl and long type
Message-Id: <6a4da8$dfe$3@news.net.uni-c.dk>
Christian Mondrup <reccmo@sc03.sctp.dk> wrote:
: Monica Fernandez Barreiro <monica@enol.tid.es> wrote:
: : Hello:
: : I have a problem when I try to insert a variable long type
: : in the data base. In a exactly way I'm going to write the
: : code and the place where it doesn't work:
: : $txt = "insert into cuerpo_certificados
: : (email_mayusculas, codigo) values
: : ('$email_upper', :1)";
: Try
: $txt = "insert into cuerpo_certificados
: (email_mayusculas, codigo) values
: (\'$email_upper\x', :1)";
Sorry for the error. What I meant was
$txt = "insert into cuerpo_certificados
(email_mayusculas, codigo) values
(\'$email_upper\', :1)";
: : $csr = &ora_open ($lda, $txt) || return (1, $ora_errstr);
: : &ora_bind($csr, $certificado);
: : do ora_close($csr) || return (1, $ora_errstr);
: : When the system tries to run the ora_bind it becames stoped and
: : useless to do anything.
: : That's all.
: --
: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
: + Christian Mondrup, Computer Programmer +
: + Scandiatransplant, Skejby Hospital, University Hospital of Aarhus +
: + Brendstrupgaardsvej, DK 8200 Aarhus N, Denmark +
: + Phone: +45 89 49 53 01, Telefax: +45 89 49 60 07 +
: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Christian Mondrup, Computer Programmer +
+ Scandiatransplant, Skejby Hospital, University Hospital of Aarhus +
+ Brendstrupgaardsvej, DK 8200 Aarhus N, Denmark +
+ Phone: +45 89 49 53 01, Telefax: +45 89 49 60 07 +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------
Date: 21 Jan 1998 10:25:36 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Oraperl and long type
Message-Id: <6a4if0$dm$1@lyra.csx.cam.ac.uk>
Christian Mondrup <scancm@biobase.dk> wrote:
>: Monica Fernandez Barreiro <monica@enol.tid.es> wrote:
>: : Hello:
>: : I have a problem when I try to insert a variable long type
>: : in the data base. In a exactly way I'm going to write the
>: : code and the place where it doesn't work:
>
>: : $txt = "insert into cuerpo_certificados
>: : (email_mayusculas, codigo) values
>: : ('$email_upper', :1)";
>
>Sorry for the error. What I meant was
>
> $txt = "insert into cuerpo_certificados
> (email_mayusculas, codigo) values
> (\'$email_upper\', :1)";
What difference is that supposed to make? ' isn't a special character
inside "". If you want to get a \ into the final string, you'll need
to write \\' not \'.
But I suspect the original error is somewhere entirely different.
Mike Guy
------------------------------
Date: Wed, 21 Jan 1998 10:17:52 +0000
From: Tony Arnold <tony.arnold@mcc.ac.uk>
Subject: Outlook 97 and perl scripts
Message-Id: <34C5CB50.B0BE5D5F@mcc.ac.uk>
I believe it ought to be possible to process mail folders etc., in
Outlook 97 from a perl script. Has anyone done this? If so, I would
appreciate seeing an example of the techinique.
Tony Arnold, University of Manchester, UK.
------------------------------
Date: Wed, 21 Jan 1998 12:33:47 GMT
From: lubej@amis.net (Robert Lubej)
Subject: perl - ms sql
Message-Id: <34c5e97e.19122973@news.amis.net>
Is there a way to get to the Microsoft SQL server database from a perl
program (actually a cgi script) on UNIX (FreeBSD)?
We have a database on NT server, but we don't want other people to
have direct access to it, so we don't have a web server on that
machine but on another under FreeBSD (Apache web server). At the
moment i can only think of writing a server program on NT to which a
perl script would connect through sockets...
------------------------------
Date: 21 Jan 1998 11:52:36 GMT
From: mmj@masskara.philonline.com.ph (Michael J. Maravillo)
Subject: perl equivalent of stty...?
Message-Id: <slrn6cdh11.4at.mmj@masskara.philonline.com.ph>
I have the following line in my code:
system("/bin/stty echo -raw > /dev/ttyS0 < /dev/ttyS0");
Is there such equivalent in "pure" perl?
TIA,
Mike
[ Michael J. Maravillo Philippines Online ]
[ System Administrator PGP KeyID: 470AED9D InfoDyne, Incorporated ]
[ http://www.philonline.com/~mmj/ (632) 890-0204 ]
------------------------------
Date: Sun, 18 Jan 1998 19:06:43 -0800
From: Peter Prymmer <pvhp@forte.com>
To: wlemke@iris.nyit.edu
Subject: Re: perl for NT
Message-Id: <34C2C343.60C1@forte.com>
wlemke@iris.nyit.edu wrote:
>
> Hi,
>
> I'm using Perl 5.001 for windows NT. My problem is with a system command
> that I want to use in a perl script.
>
> If I issue the command: net use x: \\someothercomputer\c$
>
> The command will complete successfully, and the drive mapping will occur
> perfectly.
>
> I'd like to put this command in a perlscript, so I tried:
>
> exec "net use x: \\someothercomputer\c$";
>
> and
>
> system "net use x: \\someothercomputer\c$";
>
> Neither of them worked. I get errors like: System error 67 has occured.
> and: The network name cannot be found.
>
> What is wrong here?
>
> Thanks
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
The backslash-c-dollar sign is Ctrl-$ in perl is it not?
Perhaps you wanted to write \\c$ instead.
Peter Prymmer
------------------------------
Date: Wed, 21 Jan 1998 11:32:14 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: perl for NT
Message-Id: <genepoolEn4tDq.1qr@netcom.com>
: wlemke@iris.nyit.edu wrote:
: > I'd like to put this command in a perlscript, so I tried:
: > exec "net use x: \\someothercomputer\c$";
: > Neither of them worked. I get errors like: System error 67 has occured.
: > and: The network name cannot be found.
: >
: > What is wrong here?
Try using: exec "net use x: \\\\someothercomputer\\c$";
You have to escape your backslashes.
HTH.
Cheers,
Jim
------------------------------
Date: 21 Jan 1998 10:06:44 GMT
From: pmarquess@bfsec.bt.co.uk (Paul Marquess)
Subject: Re: Problems with DBFile
Message-Id: <6a4hbk$eep$1@pheidippides.axion.bt.co.uk>
[ Posted & Mailed]
Jonathan Nicholson (jono@nospam.nowhere.noorg) wrote:
> Hi, I've got a fairly major application that is written in perl and relies
> heavily on the Berkley DB interface.
> I'm using the DB_Hash method to read/write from disk. The code has been
> very reliable in my testing of the code, but since it has gone into a
> production system the database has become corrupted quite frequently, with
> elements either not being saved correctly or elements not being updated
> correctly.
> This is causing some problems! The database is so critical to the
> application that I've been keeping fragmented backups so I can recreate
> the whole thing, it's just tedious and not something that you want to have
> to do every day (about how often the corruptions are happening).
> The database is accessed across NFS, at this time NFS locking isn't
> implemented due to unrelated problems, the same corruptions have been
> experienced when NFS locks are in place.
> I'm opening the database with the line:-
> $outputdb = tie(%datatie, "DB_File", $MASTER_DB, O_RDWR|O_CREAT, 0640,
> $DB_HASH) || die "Failed to open file $MASTER_DB for write : $!\n";
> and writing values back with
> $datatie{$instance} = $newdata; # Write the data out.
> $outputdb->sync(); # Sync the database.
> Where $newdata is a packed data set which is approximately 2Kb big.
Assuming you have multiple writers, what are you doing to lock the
database?
> One of the serious weirdnesses that I have encountered with the DBfile is
> as follows:-
> The key for the hash is a project code which has the format:-
> dJ149A1631
> this code isn't acceptable for some reason, how ever another one:-
> dJ172B2031
> is fine!
> If I attempt to make an entry in the database with the first key
> (dJ149A1631) it will not work, but I can create an entry with the key
> (dJ149A1631.) fine.
> I find this very very bizzare!
So do I. Can you send me a script that exibits this behaviour?
> Any help would be greatly appreciated, please can you reply to me by email
> as well as to the newsgroup! (Address is below in anti spam format)
To help me help you I also need:
1. The version of Perl and the operating system name and version you
are running. If you are running a newish version of Perl, the
output from running "perl -V" will tell me all I need to know.
2. The version of DB_File you have.
3. The version of Berkeley DB you have installed.
4. Anything else you think is relevant.
Paul
------------------------------
Date: Mon, 19 Jan 1998 04:55:09 GMT
From: DO-NOT-REPLY-VIA-THIS-ADDRESS@go-to-www.imaristudios.com (Ari Burton, President of IMARI STUDIOS)
Subject: Programmers Wanted
Message-Id: <34c2dca8.7511683@news.eur.sprynet.com>
JUNIOR PROGRAMMERS WANTED! Are you starting out as a new programmer?
Do you want to get your feet wet working on real-world applications?
We are looking for new programmers of...
PERL/CGI/C/C+/C++/JAVA/Visual Basic etc.
Whether you know one, some, or all, you are welcome!
NOTE: We are telling you right now ahead of time that these
"positions" are *****NON-PAYING*****!
We are offering you the opportunity to get real experience behind you
by working on real applications on live websites.
We will also list you, and a short biography about you on a CREDITS
page
for any project you work on.
This will server as your first reference and JOB EXPERIENCE
when you go out hunting for real paying clients and jobs.
We believe this is an honest and fair trade for new beginning
programmers.
Work from wherever you like. Your location, age, etc. are not
important to us.
Your desire to learn, grow, and become the best you can be IS
important to us!
If you, or any of your friends are interested, please contact us!
Visit IMARI STUDIOS at http://www.imaristudios.com
E-Mail us at the contact address listed there.
(We don't post our E-Mail address here because of the spam-bots.)
I hope to hear from you all SOON!
Warmest regards,
Ari Burton, President of
IMARI STUDIOS
http://www.imaristudios.com
ari@imaristudios.com
------------------------------
Date: Tue, 20 Jan 1998 23:24:01 -0500
From: Steve Klein <thestaff@ewbooks.com>
Subject: Read/Write problem - Need Help
Message-Id: <34C57860.E4E21979@ewbooks.com>
I wrote a Perl script that does search/replace for various words in a
file. I'm reading from the "words" file and the "originaldata" file then
writing to the "newdata" file as the replacements are made.
The Problem:
It only processes a fraction of the replacements before stopping.
Sometimes it makes through a couple hundred lines and sometimes a couple
thousand before the program stops. The original data file is about 4500
lines (325K) and I'm making several hundred replacements. Works fine
with a very small file size. Is the size of this job a problem for Perl
or UNIX? Is there a way around this?
All files are ASCII. Running Perl 5.0 on UNIX machine.
Any help or suggestions would be greatly appreciated.
PLEASE email me at klein@vedesign.com
Steve
===================================
| A D G R A F I X |
| Website Hosting |
| |
| + No Long-Term Contracts |
| + 24-hour phone support |
| + 1 Gb of transfer per day |
| + POP with mulitiple aliases |
| + Fast T3 technology |
| + CGI scripts |
| + Web Site Manager Software |
===================================
FREE Setup - Limited Time Only!
http://www.vedesign.com
------------------------------
Date: Tue, 20 Jan 1998 23:41:07 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Read/Write problem - Need Help
Message-Id: <mbudash-2001982341070001@d8.pm20.sonic.net>
In article <34C57860.E4E21979@ewbooks.com>, Steve Klein
<thestaff@ewbooks.com> wrote:
>> I wrote a Perl script that does search/replace for various words in a
>> file. I'm reading from the "words" file and the "originaldata" file then
>> writing to the "newdata" file as the replacements are made.
>>
>> The Problem:
>> It only processes a fraction of the replacements before stopping.
>> Sometimes it makes through a couple hundred lines and sometimes a couple
>> thousand before the program stops. The original data file is about 4500
>> lines (325K) and I'm making several hundred replacements. Works fine
>> with a very small file size. Is the size of this job a problem for Perl
>> or UNIX? Is there a way around this?
>>
>> All files are ASCII. Running Perl 5.0 on UNIX machine.
>>
>> Any help or suggestions would be greatly appreciated.
>>
can we see the code, and some explanation as to how it is executed (via
browser, command line, etc.).
--
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736
------------------------------
Date: 21 Jan 1998 11:42:00 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: readdir problem
Message-Id: <isvhve6rd3.fsf@godzilla.kiere.ericsson.se>
Robert Towster <298@mp3search.com> writes:
> Can anyone tell me how I can read the filenames of the files in a
> directory sorted in chronological order with the newest files first?
Farm out the work to /bin/ls by way of system() or qx{}. That will be slow.
> From everything I can tell, readdir only will get the file list but
> not provide any method for controlling the sorting..
There's no way to control the sorting for the simple reason that there
is no sorting. Sort the names yourself after you've read them in.
Something like this should work:
$dir=".";
opendir DIR,$dir or die "Can't open $dir: $!\n";
chdir $dir;
@sorted_list = sort {-M $a <=> -M $b } readdir DIR; # Not the fastest possible
# way to do it.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: Wed, 21 Jan 1998 11:13:19 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: readdir problem
Message-Id: <34d0d6ea.11698640@news.tornado.be>
Calle Dybedahl <qdtcall@esb.ericsson.se> wrote:
>Robert Towster <298@mp3search.com> writes:
>
>> Can anyone tell me how I can read the filenames of the files in a
>> directory sorted in chronological order with the newest files first?
>$dir=".";
>opendir DIR,$dir or die "Can't open $dir: $!\n";
>chdir $dir;
>@sorted_list = sort {-M $a <=> -M $b } readdir DIR; # Not the fastest possible
> # way to do it.
Then, what is? I've though of storing -M $file into a hash for each
file, and then sort them by value. Untested code:
foreach (readdir(DIR)) { $age{$_} = -M; }
@sorted = sort { $age{$a} <=> $age{$b} || $a cmp $b } keys %age;
Bart.
------------------------------
Date: Tue, 20 Jan 1998 16:50:23 GMT
From: kschreff@harborcom.net (Schreffman)
Subject: Running Two Scripts at Once
Message-Id: <34c4d59a.1999949@nntp.harborcom.net>
Can this be done? I have a HTML form that when submitted, I
want to split the browser window into two frames and run a perl script
that will display data in each frame. Any ideas or hints???
Thanks
Ken
------------------------------
Date: Wed, 21 Jan 1998 10:19:35 +0100
From: tobez@plab.ku.dk
Subject: Re: source into binary code
Message-Id: <34C5BDA7.5AAB@plab.ku.dk>
John Stanley wrote:
> Jason Christian <jason@primal.ucdavis.edu> wrote:
> >(1) I am not trying to educate you about commercial software, I am
> >trying to educate you about (some|one) buyer(s) of software (services).
> >Why did I agree to such terms in the first place? Because,
> >unsophisticated dolt that I am, I wasn't totally clued in to the costs
> >of proprietary contracts.
>
> Then you have just proven my point. There must have been SOME reason you
> agreed to those terms, and thus there are SOME REASONS that people will
> pay for things that they could get a free version of. That is the answer
> to the question "why would anyone..."
Well, all that seems to be extremely tautological.
There is always SOME reason for ANYONE to do SOMETHING.
Such a great statement! And such a huge amount of text in this
thread...
Unproductive, at least. And boring. Huh?
Anton.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 1690
**************************************