[9109] in Perl-Users-Digest
Perl-Users Digest, Issue: 2727 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 26 16:07:45 1998
Date: Tue, 26 May 98 13:00:38 -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 Tue, 26 May 1998 Volume: 8 Number: 2727
Today's topics:
Re: -e under NT and UNIX (Ethan H. Poole)
Re: -e under NT and UNIX <hash@email.infotrade.co.uk>
Re: -e under NT and UNIX (Jeffrey R. Drumm)
Re: .= food for thought? <jgoerzen@southwind.net>
Re: An unwelcome and undeserved slap <wd@denx.muc.de>
Re: An unwelcome and undeserved slap <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de>
Re: An unwelcome and undeserved slap <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de>
Re: cksum w/ Perl? (brian d foy)
Re: Clearly define "free software" <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de>
Re: Copylefting manuals <samiss@cc.tut.fi>
Re: Copylefting manuals <samiss@cc.tut.fi>
Re: Efficient Regex's (Abigail)
Re: Efficient Regex's (Wade Williams)
Re: file size with perl and win NT (Vasile CALMATUI)
Re: GNU attacks on the open software community (Patrick Hooper)
Re: GNU attacks on the open software community (Greg Lindahl)
Re: Handling Dates Help Please (brian d foy)
Re: How do I get the full pathname of a file? <JKRY3025@comenius.ms.mff.cuni.cz>
Re: Int() gives wrong result <Russell_Schulz@locutus.ofB.ORG>
Killing a pipe-opened command in Win32? <bjs@iti-oh.com>
Re: Oraperl (John D Groenveld)
PLEASE change the Subject: headers! (was Re: Stop Chang <Russell_Schulz@locutus.ofB.ORG>
Re: press "enter" key to leave (Craig Berry)
Re: press "enter" key to leave <JKRY3025@comenius.ms.mff.cuni.cz>
Re: Problem reading large files under Win95 (Marc Haber)
Re: Problem with Renaming a file to a new name that's s <rootbeer@teleport.com>
Re: Randon files in Perl 5? (brian d foy)
SQL statement parser (Eric Chien)
Re: Suggestion Re: GNU attacks on the open software com (Thomas Bushnell, n/BSG)
UNIX Radius & Perl <cyrixdude@lancom.net>
Re: Why does "each" not go thru entire hash?? (brian d foy)
Why does this expr {...} get memory fault? <jc@ral1.zko.dec.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 May 1998 18:36:51 GMT
From: ehp@gte.net (Ethan H. Poole)
Subject: Re: -e under NT and UNIX
Message-Id: <6kf243$ia8$1@gte1.gte.net>
In article <6ketvf$tbm$1@nntpd.lkg.dec.com>, daniel.mendyke@digital.com says...
>
>The problem is not that I'm running under
>UNIX and WIN32 but that the UNIX system
>is through a server.
>
>The line is in a pl CGI script and I'm
>trying to insure the existance of image
>file before displaying them.
>
>My development system is NT using ISS ver 3.
>if I run the line
>'print qq(it's here!) if -e $image;'
>from the command line it works. But when
>calling up the script through a browser it
>doesn't.
>
>I'm looking for a way to verfiy the existence
>of image files before trying to display them.
Sounds to me, then, like it is checking for the file under a different
partition (drive letter) when called as CGI vs. when called from the command
line.
the '-e' command does indeed work quite well in both the Unix and Win32
environments -- I use it quite frequently w/o problems.
--
Ethan H. Poole | Website Design and Hosting,
| CGI Scripting...
========Personal========= | ============================
* ehp @ gte . net * | --Interact2Day--
http://home1.gte.net/ehp/ | http://www.interact2day.com/
------------------------------
Date: Tue, 26 May 1998 20:32:17 +0100
From: "Alex Barilo" <hash@email.infotrade.co.uk>
Subject: Re: -e under NT and UNIX
Message-Id: <6keupt$7hn@news3.force9.net>
RGFuaWVsIHdyb3RlIGluIG1lc3NhZ2UgPDZrZWptayR2bXAkMUBubnRwZC5sa2cuZGVjLmNvbT4u
Li4NCj4gJklzVGhlcmUoKSBpZiAtZSAkZmlsZU5hbWU7DQo+DQo+QnV0IGJlY2F1c2UgJGZpbGVO
YW1lIGlzICcvdG1wL2ltYWdlcy90aGluZy5naWYnDQo+TlQgY2FuJ3QgZmluZCBpdC4NCj4NCj5J
cyB0aGVyZSBhIG1vZHVsZSB0aGF0IGNvbnZlcnRzIGZpbGUgbmFtZXMgZm9yDQo+T1MgaW5kZXBl
bmRlbmNlPw0KDQoNCllvdSBoYXZlIG5vdGhpbmcgdG8gZG8gd2l0aCAnT1MgaW5kZXBlbmRlbmNl
JyAtIHBlcmwgdW5kZXJzdGFuZHMgJy8nIHBlcmZlY3RseS4gQXJlIHlvdSBzdXJlIHlvdSBoYXZl
IHRoaXMgZmlsZSBvbiB5b3UgY3VycmVudCBkcml2ZS4gSSBtZWFuOiANCkNVUlJFTlRfRFJJVkU6
XHRtcFxpbWFnZXNcdGhpbmcuZ2lmDQoNCkNoZWVycywNCg0KQWxleC4NCg0KLS0gDQpBbGwgeW91
IG5lZWQgaXMgUEVSTA0KDQoNCg0KDQoNCg==
------------------------------
Date: Tue, 26 May 1998 19:42:37 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: -e under NT and UNIX
Message-Id: <356b187d.365105393@news.mmc.org>
[posted and mailed]
On 26 May 1998 17:26:07 GMT, daniel.mendyke@digital.com (Daniel) wrote:
>In article <6kejmk$vmp$1@nntpd.lkg.dec.com>, daniel.mendyke@digital.com
>says...
(snip)
>
>My development system is NT using ISS ver 3.
>if I run the line
>'print qq(it's here!) if -e $image;'
>from the command line it works. But when
>calling up the script through a browser it
>doesn't.
Then it doesn't seem to be a Perl problem . . . there's some difference between
your command line and CGI environment that is preventing your script from
working as expected. I'd suggest you take a look at:
http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html
and
http://reference.perl.com/query.cgi?cgi
The former document, although unfortunately named, does contain valuable
information. The latter is a good index of Perl CGI resources. Your problem is
not really a Perl problem, so if the above resources don't help, you might want
to ask in comp.infosystems.www.authoring.cgi.
>I'm looking for a way to verfiy the existence
>of image files before trying to display them.
>
>
>Daniel Mendyke
>==============================================
>daniel@virtualvoices.com
>Sell it OnLine at http://www.virtualvoices.com
>==============================================
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: 26 May 1998 13:43:24 -0500
From: John Goerzen <jgoerzen@southwind.net>
Subject: Re: .= food for thought?
Message-Id: <r6z3edwx48j.fsf@peridot.southwind.net>
belg4mit@aol.com (Belg4mit) writes:
> >All of these could lead to syntactic ambiguities. For example, if I say
> >$a =.4;
> >do I mean to assign 0.4 to $a, or to append the string "4" to $a?
>
>
>
> no ambiguity, $a =. 4 vs $a = .4 (use spaces like you should)
I would be very annoyed at anybody wanting to change the language to
require certain amounts of whitespace at certain places solely because
some people are too lazy to remember that the operator is .= instead
of =.
Furthermore, have you considered:
$a -= 5;
and
$a =-5;
The second could be taken either as an assignment of negative 5 to $a
or to decrement $a by 5.
John
--
John Goerzen Southwind Internet Access, Inc.
E-mail: Business, jgoerzen@southwind.net; Personal, jgoerzen@complete.org
Computer Science Dept., Wichita State University, jgoerzen@cs.twsu.edu
Developer, Debian GNU/Linux <http://www.debian.org>
------------------------------
Date: Tue, 26 May 1998 17:31:35 GMT
From: Wolfgang Denk <wd@denx.muc.de>
Subject: Re: An unwelcome and undeserved slap
Message-Id: <EtKrCn.nn9.7.denx@denx.muc.de>
egkioule@u.washington.edu (E. Gkioulekas) writes:
>But there's a difference. I think the GNU Linux issue is valid, whereas
>calling Perl, GNU Perl wouldn't make sense.
Ok, let's state that here we disagree.
>Let me explain why. When we talk of a kernel, it's called Linux. No doubt
>about that. When we talk of a system, I claim we should call it GNU/Linux.
>The key is understanding what we mean when we say "system". For me
>system is all the components that combined with the kernel make your
>computer sufficiently usable so you can do software development
>and write _applications_ that run on that system. So if you look at
>the base minimal system, it is predominantly indeed composed of GNU tools,
>the kernel, and some additional tools that are linux only (like the 'free'
>command). So it makes sense to talk of the GNU/Linux *system*
Umm... Now what about perl? Perl is part of the toolkit, providing
some excellent features of its own, and making use of it's
environment for other things where it doesn't make sense to re-invent
the wheel.
So when I code
system ("cp -r $old_dir $new_dir");
and I happen to use a `cp' command from the GNU fileutils - is this a
GNU Perl then? Where is the line to draw?
IMHO, Linux is Linux, Perl is Perl, and GNU utilities is something
else. YMMV.
>That is really GNU/Linux + free applications (by many communities, Linux, Tcl,
>Perl, X11, TeX, etc...). I am not sure if FSF really means it like this,
Yes, they mean it like this, and so do you. Or you would have written:
"That is really Linux + free applications (by many communities,
Linux, GNU, Tcl, Perl, X11, TeX, etc..."
>Unfortunately RMS was not tactful about it, and he has invalidated his
>claim in the eyes of many people, but I do think he has some sort of point.
I was one of his fans; this has changed *much*.
>Another angle that he emphasises more in his text is that "GNU system"
>is more an idea issue than an "ownership" issue. It is the idea that
>software should be free, and I believe that RMS cares more about the
>idea being emphasized than taking whatever credit of "ownership".
Free software (and documentation, of course) is excellent, but I
cannot understand why all this has to be labeled "GNU". It's wrong.
>Perl on the other hand, I see it more as an application that runs on
>lots of various platforms. I don't think it is appropriate to call it
>GNU/Perl any more than it is appropriate to call it NT/Perl or Mac/Perl.
IMHO, Perl has much more of the spirit of "free software" than
anything I heard from the FSF lately...
Again, YMMV.
Wolfgang
Phone: (+49)-89-95720-110 Fax: (+49)-89-95720-112 wd@denx.muc.de
Office: (+49)-89-722-27328 wd@uebemc.siemens.de
Even if you can deceive people about a product through misleading
statements, sooner or later the product will speak for itself.
- Hajime Karatsu
------------------------------
Date: 26 May 1998 21:36:55 +0200
From: David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de>
Subject: Re: An unwelcome and undeserved slap
Message-Id: <m2af84ygbs.fsf@mailhost.neuroinformatik.ruhr-uni-bochum.de>
lindahl@rt.com (Greg Lindahl) writes:
> rodgerd@orwell.rm.gen.nz (Rodger Donaldson) writes:
>
> > You really want *another* thread on this?
>
> No. The entire "GNU Linux" thread was extremely non-constructive, so
> everyone really should avoid it like the plague.
Tell that to RMS.
--
David Kastrup Phone: +49-234-700-5570
Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut f|r Neuroinformatik, Universitdtsstr. 150, 44780 Bochum, Germany
------------------------------
Date: 26 May 1998 21:40:35 +0200
From: David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de>
Subject: Re: An unwelcome and undeserved slap
Message-Id: <m290noyg5o.fsf@mailhost.neuroinformatik.ruhr-uni-bochum.de>
egkioule@u.washington.edu (E. Gkioulekas) writes:
> Let me explain why. When we talk of a kernel, it's called Linux. No
> doubt about that. When we talk of a system, I claim we should call
> it GNU/Linux.
My correct name is David Kastrup, but everybody familiar with me calls
me David. People insisting that nobody including my friends should
call me familiarly "David" are not necessarily improving the
atmosphere, whether or not there is some reasoning behind it.
--
David Kastrup Phone: +49-234-700-5570
Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut f|r Neuroinformatik, Universitdtsstr. 150, 44780 Bochum, Germany
------------------------------
Date: Tue, 26 May 1998 14:03:55 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: cksum w/ Perl?
Message-Id: <comdog-ya02408000R2605981403550001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6k6v25$p3m$1@duke.squonk.net>, chrish@squonk.net (Chris Hamilton) posted:
>Rich Baldwin (baldwin@nssdca.gsfc.nasa.gov) wrote:
>: I am looking for a Perl script which will compute a CRC32 checksum on a
>: file. This would
>: be equivalent to UNIX cksum. I need to run this code on a VAX. Any
>: pointers?
>
>There is an MD5 module that generates, well, an MD5 checksum on a string
>or a file.
here's a little script i use to give me the MD5 digest of files.
sri[4] more md5
#!/usr/bin/perl -w
use strict;
use MD5;
use File::PathConvert qw(realpath);
my $context = new MD5;
foreach my $file (@ARGV)
{
my $abs_file = realpath($file);
$context->reset();
if( open(FILE, $abs_file) )
{
$context->addfile(\*FILE);
close FILE;
print "$file: ", $context->hexdigest(), "\n";
}
else
{
print "Could not open file [$file]\n";
}
}
--
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>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
------------------------------
Date: 26 May 1998 21:36:04 +0200
From: David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de>
To: Scratchie <upsetter@ziplink.net>
Subject: Re: Clearly define "free software"
Message-Id: <m2d8d0ygd7.fsf@mailhost.neuroinformatik.ruhr-uni-bochum.de>
Scratchie <upsetter@ziplink.net> writes:
> In comp.lang.perl.misc Klaus.Schilling@home.ivm.de wrote:
>
> : Proprietary software like oracle is immoral.
>
> This is bizarre beyond words. I'm trying to conceive of what thought
> process would lead you to the conclusion that it's immoral to create a
> useful product and charge money for it.
To help you in that task, I recommend that you look over a few dozen
posts of Klaus Schilling. Might save you some work in conceiving
thought processes.
--
David Kastrup Phone: +49-234-700-5570
Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut f|r Neuroinformatik, Universitdtsstr. 150, 44780 Bochum, Germany
------------------------------
Date: 26 May 1998 22:16:45 +0300
From: Sami Sandqvist <samiss@cc.tut.fi>
Subject: Re: Copylefting manuals
Message-Id: <m3g1hwg7vm.fsf@ehdo.ton.tut.fi>
Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels) writes:
> In article <m367it712u.fsf@ehdo.ton.tut.fi>,
> Sami Sandqvist <samiss@cc.tut.fi> writes:
> > I work as a programmer. In my country, if not otherwise agreed on, the
> > employer gets the copyrights for my code. I can not GPL it.
> *All* your code? Even the code you write at home on your own
> machine during weekends and holidays? If that's the case,
> then such an employment contract is *evil*.
No, only the code I make at work. I use Perl among other tools.
> > Would you
> > not want to answer my questions about, for example, Perl? Am I evil?
> > Do I "refuse to cooperate"?
> No, you're not 'evil', and notice that the word wasn't used by
> RMS. As usual, his viewpoint is totally coherent. He did say
Saying "Am I 'evil'", where the quotes imply that 'evil' is a
quotation would mean I claim he used the word. Only I used this
word. Can you answer my question? I am not attacking the GNU
community.
> that it is a difficult question, and that there is a case to
> be made for allowing it.
>
> After all the hullaballoo, RMS's posts were factual, and
> moderate. Please don't quote out of context.
Would you explain this sentence and its context? I am not a native
speaker of english.
"Fairness says no; writing non-free programs is refusing to cooperate
with the free software community, so that activity does not deserve
any help from us."
Does it not mean, that when I write non-free programs (at work, for
instance) I should not be helped? If my interpretation is correct,
should I be refused the documentation for the tools I use at work or
at home to write non-free programs?
Mayve I should add that I have never written a non-free program on my
own time; instead, I have written and given away without any copyright
whatsoever many short programs (in Perl) for free for people who have
asked for help. I am definately not against free software. It is only
the quote above that disturbs me.
I am setting the followups to gnu.misc.discuss only and subscribing to
read this thread.
Sami
--
#!/bin/perl -w
$_="wee buvkz\nucy!xrtashnpm lrkeprr qloejhithognfaajdtcs";
s$([jp])$\u\$1$g;%a=split//;for(map{${lc$_}=$a{$_};$_}keys%a)
{print${lc$_}} ##Sami Sandqvist - samiss@cc.tut.fi##
------------------------------
Date: 26 May 1998 22:19:10 +0300
From: Sami Sandqvist <samiss@cc.tut.fi>
Subject: Re: Copylefting manuals
Message-Id: <m3d8d0g7rl.fsf@ehdo.ton.tut.fi>
lindahl@pbm.com (Greg Lindahl) writes:
> Sami Sandqvist <samiss@cc.tut.fi> writes:
>
> > I work as a programmer. In my country, if not otherwise agreed on, the
> > employer gets the copyrights for my code. I can not GPL it. Would you
> > not want to answer my questions about, for example, Perl? Am I evil?
> > Do I "refuse to cooperate"?
>
> Please do not put words such as "evil" into other peopole's mouths.
> That just generates unnecessary flamewars.l
Saying "Am I 'evil'", where the quotes imply that 'evil' is a
quotation would mean I claim he used the word. Do you wish to answer
my question or attack me for questioning RMS?
I am setting the followups to gnu.misc.discuss only and subscribing to
read this thread.
Sami
--
#!/bin/perl -w
$_="wee buvkz\nucy!xrtashnpm lrkeprr qloejhithognfaajdtcs";
s$([jp])$\u\$1$g;%a=split//;for(map{${lc$_}=$a{$_};$_}keys%a)
{print${lc$_}} ##Sami Sandqvist - samiss@cc.tut.fi##
------------------------------
Date: 26 May 1998 18:01:27 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Efficient Regex's
Message-Id: <6kf01n$22h$1@client3.news.psi.net>
Wade Williams (wwilliam@cisco.com) wrote on MDCCXXIX September MCMXCIII
in <URL: news:wwilliam-2605981134210001@10.0.0.2>:
++ Ok, don't kill me to badly on this one. :)
++
++ I've got a program that needs to read through a 2.8 MB file every 5
++ minutes. The file looks like:
++
++ ID,wade
++ fired,54000
++ hits,23000
++
++ etc - record after record. While the fields are static, the length of
++ each field is not - i.e. fired could be 40 instead of 54000.
++
++ Naturally, I did something like
++
++ while (<MYFILE>)
++ {
++ /^ID,(\d+)$/ && do
++ {
++ $id=$1;
++ last;
++ };
++
++ /^fired,(\d+)$/ && do
++ {
++ $myhash{"$id"}{fired}=$1;
++ last;
++ };
++
++ /^hits,(\d+)$/ && do
++ {
++ $myhash{"$id"}{hits}=$1;
++ last;
++ };
++ }
++
++ This is just snippet of the real code. In reality, there's probably 40 or
++ so Regex's in the while loop.
Are you sure you want the 'last' here? That is, you only do something
once, and then finish?
++
++ What I'm finding, both through experience and research is that this may be
++ the most inefficient method possible to do this. Currently, to read the
++ 2.8 Mb file and create the large hash, takes 4:15.
++
++ Obviously, one reason for this is the linear nature of my loop. If it's
++ the 39th regex that will match, my while loop forces it to try 38 other
++ regex's first.
++
++ So, my question is, how can I speed this up? Yes, I've read the FAQ
++ section on matcing a large number of regex's, but quite frankly, it didn't
++ make a whole heck of a lot of sense to me.
But those 38 other regexes won't take that long. They are all anchored,
and hence will detect failure after one or two characters. However, you
might want to do:
(Assuming you want 'next' where you wrote 'last')
my %subs = {
ID => sub {$id = $_ [0]},
fired => sub {$myhash {$id} {fired} = $_ [0]},
hits => sub {$myhash {$id} {hits} = $_ [0]},
...
}
while (<MYFILE>) {
my ($word, $number) = split /,/;
next unless defined $word && defined $number;
$subs {$word} -> ($number);
}
Of course, if all other conditions are of the form '$myhash{$id}{hits}=$1;'
you can do:
while (<MYFILE>) {
my ($word, $number) = split /,/;
next unless defined $word && defined $number;
do {$id = $word; next} if $word eq 'ID';
$myhash {$word} = $number;
}
Abigail
--
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
${qq$\x5F$} = q 97265646f9 and s g..g;
qq e\x63\x68\x72\x20\x30\x78$&eggee;
{eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'
------------------------------
Date: Tue, 26 May 1998 13:40:22 -0500
From: wwilliam@cisco.com (Wade Williams)
Subject: Re: Efficient Regex's
Message-Id: <wwilliam-2605981340230001@10.0.0.2>
In article <Pine.GSO.3.96.980526101314.27437F-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
>What if you did something like this?
[snip]
>Now it should be faster, I think. (If any of the 40 possible words has a
>different action, you may even be able to usefully use a coderef as the
>value of the hash. But if you don't know what that means, ignore it. :-)
Hehe, I do know what a coderef is. I'm just not an absolute guru so I was
looking for simple terms so I wouldn't have to ask for additional
explanation.
Your suggestion was great Tom. I went from 4 minutes, 15 seconds to 38
seconds. :)
Much more palatable.
Wade
--
---------------------------------------------------------------------------
Wade Williams "Any escape might help to smooth the
Systems Engineer, CCIE #3373 unattractive truth, but the suburbs
Cisco Systems, Inc. have no charms to soothe the restless
Brentwood, TN dreams of youth."
615-221-2918 - N. Peart
wwilliam@cisco.com
---------------------------------------------------------------------------
------------------------------
Date: Tue, 26 May 1998 19:32:47 GMT
From: vasile@club-internet.fr (Vasile CALMATUI)
Subject: Re: file size with perl and win NT
Message-Id: <356b0e57.1693425@news.club-internet.fr>
jim_lawhon@bigfoot.com (Jim Lawhon) wrote:
>>I have also a problem with big files under Win95.
>>The problem is that I can read only the first 4-5 Mb from the file (total length is 25 Mb).
>>It works well by splitting the file in some little files of 4 Mb.
>>
>>PS : I'm using Perl for Win32 "normal version" (not ActiveState) version 5.004_02
>Where is your script failing?
It does not fails, no message, it just exits normally.
> Does it appear to function properly
>(except for processing the entire file) or are there error conditions?
>EOF condition? Out of memory?
No errors at all.
The script is simple(little) enough, so I post it entirely.
#Takes all the UNIQUE URL from a file and put them in another file
my @fromFile = ("big25MbFile.txt");
my $outputFile = "allURL.txt";
my @all;
foreach $file (@fromFile) {
#reading the file entirely
open (FROM,"$file") || die " Error opening file: $file\n";
while (<FROM>) {
my @url=/(http:.*)/;
if(scalar(@url)>0) {
push(@all,@url);
}
}
close (FROM);
}
open (OUTPUT,">$outputFile") || die " Error opening file: $outputFile\n";
print "We have ", scalar(@all), " URLs\n";
my $prev;
#for counting
my $count=0;
foreach $curr (sort @all) {
#ignoring the same URLs
if($curr ne $prev) {
print OUTPUT $curr, "\n";
$count++;
$prev=$curr;
}
}
close (OUTPUT);
print "We have $count unique URLs";
Hoping you can do something.
bye
- -
Vasile Calmatui
vasile@club-internet.fr
http://www.chez.com/vasile/vasjavafr.html
------------------------------
Date: Tue, 26 May 1998 17:46:39 GMT
From: phooper@top.monad.net (Patrick Hooper)
Subject: Re: GNU attacks on the open software community
Message-Id: <356aff99.27551241@nebsnews.nebs.com>
On 21 May 1998 15:11:24 GMT, chris+usenet@netmonger.net wrote:
>In article <6k0gm3$827$3@csnews.cs.colorado.edu>,
>Tom Christiansen <tchrist@mox.perl.com> wrote:
>> [courtesy cc of this posting sent to cited author via email]
>>
>> In comp.lang.perl.misc,
>> Klaus.Schilling@home.ivm.de writes:
>> :X is not needed at all by the GNU/Linux system. One can do extremely well
>> :without any GUI stuffs. Thus I don't have any X stuff installed at all.
>>
>> Oh stop this silliness. It's Linux. Adding the word "GNU" is an insult.
>
>And you don't acknowledge the point of view that it is an insult to
>call it "The Linux Operating System" even though it consists almost
>entirely of GNU code. What about the moral rights of the GNU authors?
>Aren't they being raped by the evil Linus who wants to take their GNU
>project and put his name on it and call it his own?
>
>I don't agree with that argument (mostly because I know that Linus
>does not feel that way, and few, if any, of those who don't say
>"GNU/Linux" intend any disrespect or slight to the GNU project).
>But it seems to me that it's pretty much the same as your argument
>about Perl. I could make a module called Masto and distribute
>it along with Perl, calling it "The Masto System". If that caught
>on and you started to see CD-ROMs in stores and news articles on CNN
>about this new amazing Masto system, would it not bother you that
>Perl gets no credit?
>
>It's not an insult to add "GNU" - it's a request to acknowledge the
>GNU project's contributions to Linux-the-OS. It helps raise public
>visibility for the FSF.
>
>I usually call it "Linux", and I personally prefer BSD systems, but
>that doesn't mean I'm incapable of understanding RMS' argument.
>--
> Christopher Masto <chris+usenet@netmonger.net>
> Director of Operations, NetMonger Communications, Inc.
>
> "Behold the Power of Cheese"
Isn't this a Perl group? And in the scheme of things Linux or
anything else to do with computers really doesn't mean much. Go play
with your kids or visit your mother. Linux didn't change your diaper.
------------------------------
Date: 26 May 1998 19:05:43 GMT
From: lindahl@pbm.com (Greg Lindahl)
Subject: Re: GNU attacks on the open software community
Message-Id: <6kf3q7$gv7@news1.newsguy.com>
phooper@top.monad.net (Patrick Hooper) writes:
> Isn't this a Perl group?
No, this set of flamewars was cross-posted by you-know-who to
comp.lang.perl.misc and gnu.misc.discuss.
-- g
------------------------------
Date: Tue, 26 May 1998 15:49:06 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Handling Dates Help Please
Message-Id: <comdog-ya02408000R2605981549060001@news.panix.com>
Keywords: from just another new york perl hacker
In article <356AE329.2F2A68A7@matrox.com>, Ala Qumsieh <aqumsieh@matrox.com> posted:
>johnny99@sydney.dialix.oz.au wrote:
>
>> Today is 26/5/98, so the "today" script would take you to a page called
>> 98-05-26.html -- but what I'd like to do is enable browsers to go backward and
>> forward with buttons on the pages marked "Next Day" and "Previous Day".
># Previous day
>$day--;
>if ($day == 0) {
> $month--;
> # set $day to either 30 or 31 (maybe even 28/29 in the case of February)
>depending on month
>}
looks like a lot of work. rather than spend one's time coding date
algorithms, just jump right to the functionality :)
#!/usr/bin/perl
use subs qw(make_file_name);
$\ = "\n";
@yesterday = localtime(time - 24 * 60 * 60);
@tomorrow = localtime(time + 24 * 60 * 60);
print "Yesterday's file is ", make_file_name(\@yesterday);
print "Today's file is ", make_file_name([localtime]);
print "Tomorrow's file is ", make_file_name(\@tomorrow);
sub make_file_name
{
my $array_ref = shift;
$$array_ref[4]++; #month - zero based
$$array_ref[5] += 1900; #year - offset from 1900
"$$array_ref[5]-$$array_ref[4]-$$array_ref[3].html";
}
__END__
>Was that hard to figure out?
i guess you like to do things the hard way.
--
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>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
------------------------------
Date: Tue, 26 May 1998 20:35:26 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
To: Bas <Kortleven@holmes.nl>
Subject: Re: How do I get the full pathname of a file?
Message-Id: <356B89FE.2276@comenius.ms.mff.cuni.cz>
Bas wrote:
>
> Hello,
>
> I am a student in Holland and (if you have time and I am allowed) I would
> like to ask you one question.
>
> I start one of my Perlscripts like : perl parse_debug.pl debug
>
> So debug is the file that will be parsed. What I want is the full pathname
> of debug (in my case.../home/bas/debug). I tried to do it with use Cwd but
> this only works properly when the perlscript and the file are in the same
> directory. Then I tried it with find2perl but this takes too long (it
> searches the complete Unixsystem).
>
> Isn't it possible to look backwards? Like I have got the file debug and
> before debug comes bas and before bas comes home and that's it.
>
> I hope to hear from you but I can imagine that you are busy..........if you
> haven't got time just leave it then.
>
> greetings
>
> Bas Kortleven
I'm sure there is a module for this, but lets start reinventing the
wheel.
#beware untested code
use Cwd;
$file = $ARGV[0];
unless ($file =~ m#^/#) {
my $dir = cwd();
$file = $dir . $file;
$file =~ s#/\./#/#g;
$file =~ s#//#/#g; # just in case
$file =~ s#/.*?/\.\./#/#g;
}
print "Full name of file $ARGV[0] is $file\n";
HTH, Jenda
------------------------------
Date: Tue, 26 May 1998 15:20:28 +0100
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: Int() gives wrong result
Message-Id: <19980526.152028.0Z7.rnr.w164w@locutus.ofB.ORG>
k_wong@my-dejanews.com writes:
> $a="592.68"
> print int($a*100)
> 59267
alas.
> Is there something wrong?
$a was not exactly 592.68 -- it was very close, but just like base 10
has infinite decimals (like 1/3), so does base 2 (like, inconveniently
enough, 1/10) -- and your computer is using base 2.
if you set $b to `$a*100' and look at `$b-59268', you will find a
very tiny negative number; that's what's causing this behavior.
> (Please email and post)
the newish `Mail-Copies-To: poster' header would have done this (on
the more actively-maintained newsreaders).
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: Tue, 26 May 1998 14:26:45 -0400
From: "Brian J. Sayatovic" <bjs@iti-oh.com>
Subject: Killing a pipe-opened command in Win32?
Message-Id: <6kf1ot$p72$1@malgudi.oar.net>
If I do something like:
open(PROG, "prog |");
How can I later kill this process? Closing it still waits for the process
to finish, so it seems I need to kill it by PID. Open seems to be returning
simply 1. Is there a way to get prog's PID so I can kill it -- or is there
a better way in general?
Brian.
------------------------------
Date: 26 May 1998 15:16:52 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Oraperl
Message-Id: <6kf4f4$99s$1@tholian.cse.psu.edu>
No problems here. Can you reproduce the error? Can you post some sample code?
John
groenveld@acm.org
------------------------------
Date: Tue, 26 May 1998 15:14:56 +0100
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: PLEASE change the Subject: headers! (was Re: Stop Changing Subject Lines!!)
Message-Id: <19980526.151456.7q6.rnr.w164w_-_@locutus.ofB.ORG>
Peter A Fein <p-fein@uchicago.edu> writes:
> Look, this GPL/Perl/FSF discussion is very entertaining, but it would
> make some of us *real* happy if you all would stop changing subject
> lines every post.
I've seen all of 5 (less?) different ones; your hyperbole is staggering.
> It makes generating a useful killfile damn near impossible.
different-newsreader comments aside (the one I wrote doesn't have such
a powerful kill-thread facility*), I _encourage_ people to change the
Subject: header when a topic changes.
I mean, isn't that what Subject: headers are for?
of course, I also encourage people talking about GNU vs. Linux to
not crosspost into comp.lang.perl.misc , but it's a start.
* - I find that long threads usually vary wildly enough that killing
the thread as a whole isn't something I want anyway.
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: 26 May 1998 17:51:34 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: press "enter" key to leave
Message-Id: <6kevf6$bd8$3@marina.cinenet.net>
Johnson Chen ( C. H. Chen)A (chia_ch@alcor.concordia.ca) wrote:
: How can I make users to leave this following program if user press only
: enter key ?
[snip]
: ???? if ($name_input == " ") { last NAMEENTER;} else {
Two problems there. You're using the numeric rather than the string
equality test operator, and even if you used the string version, you'd be
testing for the user having entered a single space, rather than 'nothing'.
Together, these two hints should get you rolling. Best of luck!
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Tue, 26 May 1998 20:45:45 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: press "enter" key to leave
Message-Id: <356B8C69.6BD2@comenius.ms.mff.cuni.cz>
Johnson Chen ( C. H. Chen)A wrote:
>
> How can I make users to leave this following program if user press only
> enter key ?
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> #!/local/paths/perl -w #indicat the path
>
<stuff deleted>
>
> NAMEENTER: while (1) {
> print "\tEnter the name to see the gif file ...";
> chomp ($name_input=<>);
last if ($name_input eq '');
<rest of script deleted>
>
> johnson
HTH, Jenda
------------------------------
Date: Tue, 26 May 1998 19:21:38 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: Problem reading large files under Win95
Message-Id: <6kf4o8$2c2$3@nz12.rz.uni-karlsruhe.de>
David Carter <david@solbors.no> wrote:
>> I have a problem with big files under Win95.
>>
>> The problem is that I can read only the first 4-5 Mb from the file (total length is 25 Mb).
>> It works well by splitting the file in some little files of 4 Mb.
>>
>> Is this a Perl limitation ? Or Win95 ? On Perl under Win95 ?
>> Had anybody else this problem ? A solution ?
>
>FDISK is what you need.
Would you care to explain your answer please? If you don't, I would
consider it misleading if not dangerous.
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: Tue, 26 May 1998 19:43:10 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Problem with Renaming a file to a new name that's specified by a variable
Message-Id: <Pine.GSO.3.96.980526124003.27437P-100000@user2.teleport.com>
On 26 May 1998, Alexandr Dubovikov wrote:
> You must to do it
>
> rename ("../htdocs/toast/matches/temp.html",
> "../htdocs/toast/matches/.$in{filename}");
Of course, $in{filename} may easily lead to '../../../some/vital/file'.
Yow!
Data from a remote user should always be presumed guilty until proven
innocent.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 26 May 1998 14:08:35 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Randon files in Perl 5?
Message-Id: <comdog-ya02408000R2605981408350001@news.panix.com>
Keywords: from just another new york perl hacker
In article <3569956D.C6B3F865@matrox.com>, Ala Qumsieh <aqumsieh@matrox.com> posted:
>Scott Vetter wrote:
>
>> Is it possible to have random files that can be read and written to
>> by a Perl 5 programs?
>1) Generate a random file name. Your best bet is to use a combination of
>the processid ($$) and the local time to create your random seed.
>srand( time() ^ ($$ + ($$ << 15)) );
>$name = int rand ($$ + 1);
>
>2) Open the file for writing
>open FILE, "$name.txt" or die "Can't open $name.txt: $!";
of course, you're forgetting to check to see if the file already
exists before you overwrite it.
--
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>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
------------------------------
Date: Tue, 26 May 1998 19:22:11 GMT
From: ecchien@jps.net (Eric Chien)
Subject: SQL statement parser
Message-Id: <356b161a.7742919@news>
Hello,
Has anyone written a module that parses an SQL statement and checks it
for validity? Basically something that parses the tokens and verifies
the statement is complete and formed correctly.
Email replies appreciated.
Thanks,
...Eric
------------------------------
Date: 26 May 1998 13:50:57 -0400
From: tb@mit.edu (Thomas Bushnell, n/BSG)
Subject: Re: Suggestion Re: GNU attacks on the open software community
Message-Id: <u1hvhqsj4zi.fsf@pusey.MIT.EDU>
? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> writes:
> There is a fundermental diffrence. iIn this case its your beleafes that
> are being attacked, not you. Its not weather or not he likes or dislikes
> you, but weather he dislikes or likes your arguments.
In this particular case, Tom has attacked me, personally, with words
such as "Damn you to hell", posted in a public forum, on the basis of
his dislike for my ideas.
------------------------------
Date: Tue, 26 May 1998 19:05:03 GMT
From: "Eric Alexander" <cyrixdude@lancom.net>
Subject: UNIX Radius & Perl
Message-Id: <znEa1.650$VX6.680629@news.randori.com>
Hi, I'm needing a script that will open the detail file that Radius uses and
clear out all the starts and stops except for the starts that do not have
stops.. I am sort of good with Perl, but not that good. If anyone knows of a
script to do this, or could possibly help me, please get in touch! Thanks!
Eric Alexander
Landmark Communications
------------------------------
Date: Tue, 26 May 1998 14:11:59 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Why does "each" not go thru entire hash??
Message-Id: <comdog-ya02408000R2605981411590001@news.panix.com>
Keywords: from just another new york perl hacker
In article <3569916B.FA2C8EF7@matrox.com>, Ala Qumsieh <aqumsieh@matrox.com> posted:
> I don't exactly get the question. But I think the "problem" might be with
why "think"? there's no need to guess when you can test it yourself.
>the way Perl stores its hashes (in an "apparently" random order). Of course,
>it does so to maximize memory usage efficiency.
how is it more memory efficient? you still have to store the data!
>Ignore my comments if I'm totally off :-)
we can't ignore your comments. they're archived at Deja News. if nobody
stepped in to correct mistakes, others might think you were right.
--
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>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
------------------------------
Date: Tue, 26 May 1998 15:27:03 -0400
From: John Chambers <jc@ral1.zko.dec.com>
Subject: Why does this expr {...} get memory fault?
Message-Id: <356B1787.4142ECEF@ral1.zko.dec.com>
This is with 5_.004_04 built for alpha-dec_osf, from the most recent
sources (which I just checked and haven't changed any). On someone
else's recent advice, I've been trying to use eval to trap a timeout
on a connect, and when the timeout happens, rather than trapping the
problem, the code bombs and leaves behind a 27 Mbyte core file. The
most recent version of the code (which has gone through a number of
tweaks, all of which bomb) looks like:
eval {
local $SIG{'ALRM'} = sub {die "connect timed out\n"};
alarm($HTTPtimeout);
$connstat = connect(F,$that);
};
if ($@) {
...
}
I can show by adding calls of print before and after the eval block
that the code goes into the eval and doesn't come out. (Either that
or it bombs in the print routine. ;-) And, according to ps, the process
isn't using nearly 27 Mbytes of memory just before it bombs.
Is this a problem that has been faced before? Is there maybe a patch
for it lying about somewhere? Is there something subtly wrong with my
code? It seems that the code should be "just about right", because it
actually does the eval block a few dozen or hundred times before it
bombs, though the ALRM doesn't actually happen. The memory fault seems
to happen the first time the ALRM goes off.
This is all part of an ongoing attempt to learn how to successfully
get past a web server that doesn't respond correctly to a connect. A
process that bombs or blocks for hours isn't really what is needed.
------------------------------
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 2727
**************************************