[8590] in Perl-Users-Digest
Perl-Users Digest, Issue: 2207 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 30 08:17:55 1998
Date: Mon, 30 Mar 98 05:00:58 -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 Mon, 30 Mar 1998 Volume: 8 Number: 2207
Today's topics:
ANNOUNCE: IndexMaker 6.0: an index.html maker from PDF, <pivari@geocities.com>
Re: Calling all Newbies (User)
Re: debugging Perl (M.J.T. Guy)
Delete file on server! <msiezhs@microsoft.com>
Re: Delete file on server! <ebohlman@netcom.com>
Re: File::Find (Ed Avis)
Re: File::Find (Ed Avis)
Getopts::Long seemingly incompatible with 'use strict' <nwi-tech@dircon.net>
Re: Getopts::Long seemingly incompatible with 'use stri <ebohlman@netcom.com>
Grap Images from a remote web site news@alameh.net
Re: Grap Images from a remote web site <ebohlman@netcom.com>
Handling pty's - Ptty? (Steffen Kluge)
Re: Is there a "Newsgroup" for Newbies to Perl? (Craig Berry)
Re: Is this wise way to do this? (M.J.T. Guy)
newbie question:how to embed perl in html (M1)
Re: Perl Databases... (M.J.T. Guy)
Perl ong NT 4.0 <gso@orion.no>
Ping <Tim.Richter@Dresdner-Bank.Com>
Re: precedence problem (M.J.T. Guy)
Re: Problems with handling Mac/PC/Unix line breaks (Bart Lateur)
Re: Problems with handling Mac/PC/Unix line breaks (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Re: sprintf rounding error (M.J.T. Guy)
Re: Sysadmin struggeling with PERL/Sed and etc... (Joergen W. Lang)
Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ (yoboseyo)
Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ <KitchenerN@Logica.com>
Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ (Tim Hall)
Re: verifying email address -- how? (Tom Grydeland)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 30 Mar 1998 10:08:34 +0000
From: Fabrizio Pivari <pivari@geocities.com>
Subject: ANNOUNCE: IndexMaker 6.0: an index.html maker from PDF,HTML,VRML and other files
Message-Id: <351F6F21.3704CE73@geocities.com>
Hi,
I'm glad to announce the version 6.0 of IndexMaker a perl script to make
an index.html file from PDF, HTML, VRML and other files.
At the moment, it uses the /Author field, the first /Title field and in
the /Subject field every matched PDF files, the <TITLE> </TITLE>
field and the META
Description and Author fields in every matched HTML files the Info
node field in every matched VRML 1.0 files the WorldInfo node field
info and title in every matched VRML 2.0 files and the name of the file
in the others.
What's new with version 6.0
FTP support with libnet module
New documentation style
This is the URL where you can find the tool
http://www.geocities.com/CapeCanaveral/Lab/3469
--
Fabrizio Pivari
mailto:pivari@geocities.com
http://www.geocities.com/CapeCanaveral/Lab/3469/
Member of ANFACE Software
http://www.geocities.com/CapeCanaveral/Hangar/4794/
------------------------------
Date: Mon, 30 Mar 1998 09:58:48 GMT
From: you@somehost.somedomain (User)
Subject: Re: Calling all Newbies
Message-Id: <351f6ca8.1068135@news.btinternet.com>
Personally the part that seems to be missing is example code.
When I first learned to program, there were senior programmers who you
could ask stupid questions too, then would then smile, point you to a
piece of code, and e voila, you could see from the code what you had
to do.
Although there is vast amounts of code out there, small well
documented snippets, is what most "learners" would benefit from most.
If there is such a thing point to it the faq.
Some examples.
ok parse a file find something grab next three lines of code.
forget regex - loads of examples - inc oreilly book on it.
parse blank lines in file looking for certain "start codes"
Show first through code, that works, but is not the "best" way of
doing then show how you improved, it and why.
in these examples - show file, code and result, if someone wants to do
this, I'll put up the web space to put it on.
Ian
On Sun, 29 Mar 1998 06:30:25 -0600, Mark Stackhouse
<stackhou@execpc.com> wrote:
>Sneex is doing just what you suggested for us. He's a
>system administrator so it will me done right. Be sure to
>reply to him
>via e-mail if you'd like to be included. See: Anouncement
>(Re: was Calling All Newbies).
>
>--
>Mark Stackhouse
>
>***********************************************************************
>
>homepage: http://www.execpc.com/~stackhou
>
>"The best things in life aren't things."
>--Art Buchwald
>
>***********************************************************************
>>
>> So please, people learning perl out there and feeling alone with all
>> the books and documentation, go ahead and try to find a way to build
>> something like a virtual study group or maybe - in far future - a
>> virtual perl university.
>>
>> Chris - a sometimes lonesome perl learner.
>>
>> --
>> Wir suchen neue AussenMitarbeiterInnen... (S.Pernar@Link-Goe)
------------------------------
Date: 30 Mar 1998 11:12:11 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: debugging Perl
Message-Id: <6fnumb$41q$1@lyra.csx.cam.ac.uk>
In article <x71zvslj1c.fsf@sysarch.com>, Uri Guttman <uri@sysarch.com> wrote:
>William Wiley <wwiley@bedriver.com> writes:
>
>> Does anyone know of a usefull debugging environment for perl? Or am I
>> stuck using print statements.
>
>print statements are your friends. IMO the only guaranteed way to see
>what is happening. all other debuggers are helpers.
And one way the debugger can help is by putting in those print statements
for you, for example
a 123 print "Lexical variable \$my has value $my at line 123\n".
Of course, the debugger won't (currently) let you get at lexical variables
which aren't in scope. But print statements won't either.
Mike Guy
------------------------------
Date: Mon, 30 Mar 1998 17:28:39 +0800
From: "PRC IE 4.0 feedback" <msiezhs@microsoft.com>
Subject: Delete file on server!
Message-Id: <6fnoqe$r65@news.microsoft.com>
I am a newcomer of CGI and have an issue need help!
I want to delete the file on server useing perl. But can not find the
suitable function of delete file,
The name of the file would be deleted was submitted by form in home page.
Pls help me!
------------------------------
Date: Mon, 30 Mar 1998 10:28:17 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Delete file on server!
Message-Id: <ebohlmanEqMnr5.At8@netcom.com>
PRC IE 4.0 feedback <msiezhs@microsoft.com> wrote:
: I am a newcomer of CGI and have an issue need help!
: I want to delete the file on server useing perl. But can not find the
: suitable function of delete file,
It's called unlink(). While this may not be immediately obvious to
someone without a unix background, you would have been able to find it
pretty quickly if you had just done a search for "delete" in the
documentation that came with your Perl distribution. You (and anybody
else who's a newcomer to Perl programming, whether for CGI applications
or not) need to get into this habit early on if you want to make
progress; Perl comes with the equivalent of a college course in Perl
programming, *for free*, but it won't help people who refuse to look at it.
: The name of the file would be deleted was submitted by form in home page.
If you're going to do this, you need to be *very* *careful*. You need to
carefully check the submitted file name to make sure that it's one that
you really want the user to be able to delete. You want to make sure
that it doesn't contain path information pointing to someone else's
file. Since you're a newcomer, I'd strongly suggest getting an
experienced Perl programmer to look at your code *before* putting on your
server.
------------------------------
Date: Mon, 30 Mar 1998 10:20:46 GMT
From: epa@datcon.co.uk (Ed Avis)
Subject: Re: File::Find
Message-Id: <351f6a54.408595899@news-direct>
On Fri, 27 Mar 1998 21:09:42 GMT, aml@world.std.com (Andrew M.
Langmead) wrote:
>They didn't strip out the documentation out of Find.pm, did they?
I read the documentation at the beginning, before the actual Perl code
starts, but I didn't read the whole file.
--
Ed Avis
------------------------------
Date: Mon, 30 Mar 1998 10:20:47 GMT
From: epa@datcon.co.uk (Ed Avis)
Subject: Re: File::Find
Message-Id: <351f6a7b.408634445@news-direct>
On 29 Mar 1998 17:29:10 +0300, Jarkko Hietaniemi <jhi@alpha.hut.fi>
wrote:
>>I'm using Perl for Win32, which doesn't include find2perl
>
>Does that distribution not have 'perldoc'?
No. It doesn't have a2p either.
I hope the "other" perl ports to Win32 are better.
--
Ed Avis
------------------------------
Date: Mon, 30 Mar 1998 11:03:25 +0100
From: "nwi-tech" <nwi-tech@dircon.net>
Subject: Getopts::Long seemingly incompatible with 'use strict'
Message-Id: <351f6d4f.0@newsread1.dircon.co.uk>
The program below is a listing of a test program i wrote to test the ability
of Getopts:Long to handle options:
When strict is specified, i must predeclare $opt_file, or the script will
not execute; if i do, $opt_file is
not defined, regardless of whether i specify anything on the command line.
#!/usr/bin/perl
use strict;
use Getopt::Long; # options module
my($opt_file); # if i declare this here, it does not
seem to be instantiated by specifying a file
# name on the command line.
my(@optl) = ("file=s"); # options
## main
GetOptions @optl; # get the options
if($opt_file)
{
file();
}
else
{
welcome(); # if always branches here unless 'use
strict' is commented out.
}
sub file
{
print("file specified\n");
}
how can i get round this problem so that i have use strict specified but i
can also instantiate $opt_file for use?
thanks
mark lewis
sub welcome
{
print("welcome invoked\n");
}
------------------------------
Date: Mon, 30 Mar 1998 10:57:16 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Getopts::Long seemingly incompatible with 'use strict'
Message-Id: <ebohlmanEqMp3G.C7u@netcom.com>
nwi-tech <nwi-tech@dircon.net> wrote:
: When strict is specified, i must predeclare $opt_file, or the script will
: not execute; if i do, $opt_file is
: not defined, regardless of whether i specify anything on the command line.
: #!/usr/bin/perl
: use strict;
: use Getopt::Long; # options module
: my($opt_file); # if i declare this here, it does not
: seem to be instantiated by specifying a file
That's because you're declaring $opt_file as a lexical variable, which is
not in Getopt::Long's scope and therefore can't be touched by GetOptions.
You need to make it a global variable, which you do with:
use vars qw($opt_file);
------------------------------
Date: Mon, 30 Mar 1998 01:23:11 -0600
From: news@alameh.net
Subject: Grap Images from a remote web site
Message-Id: <6fnh40$oqg$1@nnrp1.dejanews.com>
hi there every body,
I am using the http-lib from selena sol to make a get request and get a
remote web page, what i am looking more for is a way to get the images and
any thing more i can from the page, remotly,
simply i am doing the get and then the page is a string, i can gather all the
links to images but how i can read the images, is it the same way i did to
read html???????
and in other words i am looking for a way to download images from remote web
pages to my unix server using a perl program,
a big kiss from every body can help in this (cyber kiss no body ask me to
come and give)
Regards
it is me Issam
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 30 Mar 1998 10:19:49 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Grap Images from a remote web site
Message-Id: <ebohlmanEqMnD1.A74@netcom.com>
news@alameh.net wrote:
: I am using the http-lib from selena sol to make a get request and get a
: remote web page, what i am looking more for is a way to get the images and
: any thing more i can from the page, remotly,
I'd be inclined to use LWP myself, but the basic principles are the same.
: simply i am doing the get and then the page is a string, i can gather all the
: links to images but how i can read the images, is it the same way i did to
: read html???????
Yes. You just issue an HTTP GET for the image's URL. Remember that you
need to supply an absolute, not relative, URL because the server has no
way of knowing what a relative URL is relative to. One advantage to
using LWP is that it comes with the URL module, which has functions for
building absolute URLs from relative ones, etc. I strongly suggest you
use it rather than trying to roll your own, since the code is tested and
there a plenty of superstitions about URLs going around.
Note that LWP::Simple has a method for GETting a URL and storing the
returned content to disk, all in one swell foop. LWP comes with
comprehensive documentation and a tutorial.
------------------------------
Date: 27 Mar 1998 14:58:59 +1100
From: kluge@fujitsu.com.au (Steffen Kluge)
Subject: Handling pty's - Ptty?
Message-Id: <6ff863$6as$1@syd0128.fujitsu.com.au>
Hi everyone,
I'm looking for some documentation/info about the Ptty
module, found on CPAN. Apparently, it doesn't contain any
POD, and all the interesting things seem to be done in a C
module.
Strangely, Ptty uses Tk. This makes me wonder whether it is
really the basic pty handling stuff I'm looking for.
All I want to do is pass I/O from a serial port to a pty
(and do some stuff in between, of course :-)
Thanks in advance
Steffen.
--
Steffen Kluge <kluge@fujitsu.com.au>
Fujitsu Australia Ltd
Keywords: photography, Mozart, UNIX, Islay Malt
--
------------------------------
Date: 30 Mar 1998 07:09:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <6fngf2$qfo$1@marina.cinenet.net>
James Hurd (jhurd@ucs.indiana.edu) wrote:
: Then is is impossible for a non-programmer to use Perl,
: so this debate is actually as ridiculous as it initally appears.
It is impossible for a non-programmer to use Perl in the same sense that
it is impossible for a teetotaller to drink a Martini; either action
removes one from the corresponding category.
However, I think what's being suggested is that, to make *effective* use
of Perl (or any other programming language), there is a certain mental
attitude and behavioral approach which will lead one toward being a *good*
programmer. Such things as compulsively reading all available docs,
performing simple experiments to isolate poorly understood language
elements, and extending professional courtesy to fellow programmers all
compound to make one a better programmer.
A person who posts a FAQ, clearly without having done ten minutes of
research on the topic, is violating at least two and usually three of the
precepts above. And that's what causes the gurus to heap scorn on such a
person. Why should they respect someone who doesn't want to become a good
programmer, but instead expects others to do the hard work?
---------------------------------------------------------------------
| 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: 30 Mar 1998 12:05:00 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Is this wise way to do this?
Message-Id: <6fo1pc$5kj$1@lyra.csx.cam.ac.uk>
Joonas Timo Taavetti Kekoni <jkekoni@cc.hut.fi> wrote:
>Is there a standard way to find out wheter or not a $scalar is a \reference?
>I Think the following could get broken if internal structure changes...
See ref() and also UNIVERSAL::isa($a, 'ARRAY')
MIke Guy
------------------------------
Date: Mon, 30 Mar 1998 10:30:42 +0200
From: data_death@hotmail.com (M1)
Subject: newbie question:how to embed perl in html
Message-Id: <MPG.f8976a15c066453989680@news.xs4all.nl>
Hello,
I have a perl script for a discussion group that outputs html. if I type:
perl script.pl it gives the desired html output in my shell account.
Question: How do i call this script from a html page?
regrds,
Bart van Praag
------------------------------
Date: 30 Mar 1998 10:58:58 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Perl Databases...
Message-Id: <6fntti$3h2$1@lyra.csx.cam.ac.uk>
In article <3516DC12.6FBA@mci.com>, Bill Lewis <Bill.Lewis@mci.com> wrote:
>Ok, created just a simple script to input data to a DBM database. I
>tie'd the hash function to the database file, which currently is empty.
>
>Then in the script I assign keys and values like such:
>
>%info = $key => $value;
>
>where I interate over keys and assign different values to it.
You should always run your scripts with -w. Then perl would have told
you
Useless use of a variable in void context at ...
Odd number of elements in hash list at ...
from which you might have been able to deduce that Perl is interpreting
that as
(%info = $key) => $value;
which isn't what you want. Write instead
%info = ( $key => $value );
See the section on operator precedence at the start of perlop.
And in any case, the corrected version still assigns to the _whole_
hash, not just adding one element. Instead you probably want
$info{$key} = $value;
Mike Guy
------------------------------
Date: Sun, 29 Mar 1998 16:48:51 +0200
From: <gso@orion.no>
Subject: Perl ong NT 4.0
Message-Id: <6flmvr$ao3$1@o.online.no>
I am trying to run a perl script on a nt ws 4.0.
In the script i have: "use strict;" at line 1.
When i trying to run the script i get the error:
Can't locate strict.pm in @INC at test.pl line 1.
What is wrong?
------------------------------
Date: Mon, 30 Mar 1998 09:28:32 +0200
From: Tim Richter <Tim.Richter@Dresdner-Bank.Com>
Subject: Ping
Message-Id: <351F499F.CCC077E8@Dresdner-Bank.Com>
Hi.
Is it possible to do a "ping" to a host using only perl and not the
system4s ping-command?
I want to watch some (1300) servers in the net and only need toknow if
they are pingable. My current
solution uses the os ping-command and is far to slow.
Please reply via email.
--
Tim Richter
Tim.Richter@Dresdner-Bank.com
------------------------------
Date: 30 Mar 1998 12:10:35 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: precedence problem
Message-Id: <6fo23r$5nr$1@lyra.csx.cam.ac.uk>
Frank Scholz <fscholz@wv.mentorg.com> wrote:
>Jason Gloudon wrote:
>>
>> In article <350D8A07.D541672F@bellsouth.net>, Michael Lepine wrote:
>> >I am using the following line of code in a script that I wrote ( it is a
>> >very trivial line ):
>> >
>> >`mv $Temp_File $Update_File` or die "Cannot
>> >move\n$Temp_File\n\tTO\n$Update_File\n";
>
>You should use the 'rename()' function instead of `mv ...`:
That'll only work if the two files are on the same filesystem. For
the full functionality of "mv", see File::Copy::move.
Mike Guy
------------------------------
Date: Mon, 30 Mar 1998 07:39:55 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Problems with handling Mac/PC/Unix line breaks
Message-Id: <35234830.3126001@news.tornado.be>
Lasse Hillerxe Petersen wrote:
>If $/ could be set to a regexp, the last one would be easier and
>cleaner-looking, but unfortunately it can't. (And frankly I can't see any
>reason why Perl should be inferior to awk in this regard! Each time I see
>that comment in the perlvar page, I get slightly annoyed.)
Probably for efficiency reasons. Most Perl guru's in this newsgroup are
a bit (!) unix-centric, and you "don't need it in a Unix-only
environment".
Anyway, I think it could make ALL text file processing about twice as
slow, which is a high price to pay for a fairly uncommon situation.
HTH,
Bart.
------------------------------
Date: Mon, 30 Mar 1998 12:11:57 +0100
From: lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Subject: Re: Problems with handling Mac/PC/Unix line breaks
Message-Id: <lassehp-3003981211570001@ra.imv.aau.dk>
In article <35234830.3126001@news.tornado.be>, bart.mediamind@tornado.be
(Bart Lateur) wrote:
>Lasse Hillerxe Petersen wrote:
>
>>If $/ could be set to a regexp, the last one would be easier and
>>cleaner-looking, but unfortunately it can't. (And frankly I can't see any
>>reason why Perl should be inferior to awk in this regard! Each time I see
>>that comment in the perlvar page, I get slightly annoyed.)
>
>Probably for efficiency reasons. Most Perl guru's in this newsgroup are
>a bit (!) unix-centric, and you "don't need it in a Unix-only
>environment".
Now, that's probably the _most_ likely place where people would want it: a
Unix-only environment (thus not using a fileserver program like Xinet's,
which does CR-LF translation on text-files), receiving Mac- and
DOS-documents that are not properly converted from the beginning. Of
course, a solution would be converting the files when they are first
received, but then, that still calls for an equivalent to this solution.
Also on the Mac/PC-side. When downloading a Perl module from CPAN I
sometimes forget to use SunTar to unpack it, habitually dropping it on
Stuffit Expander instead. Alas Expander isn't as smart as SunTar, so it
extracts all files as binary files. I imagine the same goes for
DOS/Windows. So there _are_ several trivial ways to get in a situation
where such a feature would be, if nothing else, convenient.
>Anyway, I think it could make ALL text file processing about twice as
>slow, which is a high price to pay for a fairly uncommon situation.
I don't see why it would incur any penalty. The normal case could be
optimized away. And it would be convenient for other things as well, not
only line breaks. Surely if it's a feature of awk, one of the unixiest of
all Unix-programs (Aho, Weinberger and Kernighan!), then it can also be a
feature of Perl. And the comment in perlvar seems to indicate that it is
so.
But OTOH, I seem to recall a discussion, where it was argued that a
solution using some kind of IO filters could be used if sfio is used. So
$/ is not needed, after all.
-Lasse
------------------------------
Date: 30 Mar 1998 10:39:55 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: sprintf rounding error
Message-Id: <6fnspr$2u7$1@lyra.csx.cam.ac.uk>
In article <3516AC4B.2A0@erols.com>, Kevin Miles <kmiles@erols.com> wrote:
>PerlFAQ says "...it probably pays not to trust whichever system rounding
>is being used by Perl, but to instead implement the rounding function
>you need yourself."
You're quoting out of context there. The complete paragraph reads
Rounding in financial applications can have serious
implications, and the rounding method used should be
specified precisely. In these cases, it probably pays not
to trust whichever system rounding is being used by Perl,
but to instead implement the rounding function you need
yourself.
For run-of-the-mill applications, Perl sprintf and friends will
Do The Right Thing. No need to roll your own.
The point of the above paragraph is that for quantities like 14.5, the
"correct" rounding is ambiguous - it could be 15 or 14. Which is
appropriate depends on convention, not on any mathematical formula,
and could depend on context. (If it's a credit to me, round up;
if a debit, round down. :-)
So Perl can't Do The Right Thing as it has no means of knowing what
the Right Thing is.
>This rounding is so basic, I didn't think I would have to write my own
>sub. Any ideas ( some round correctly, others don't )?
It's slightly odd that you discovered the FAQ entry
Does perl have a round function? What about ceil() and
floor()? Trig functions?
without also noticing the entry two before
Why am I getting long decimals (eg, 19.9499999999999)
instead of the numbers I should be getting (eg, 19.95)?
which explains what is going on here. (And they all round correctly,
for some value of correct.)
But it can be difficult to find things in the FAQ. Like visiting Mecca,
it's probably good for the soul to read through the _whole_ FAQ at
least once during your life.
Mike Guy
------------------------------
Date: Mon, 30 Mar 1998 14:22:49 +0200
From: joergen.lang@schwaben.de (Joergen W. Lang)
Subject: Re: Sysadmin struggeling with PERL/Sed and etc...
Message-Id: <1d6pjed.nl3ffntua4xiN@host055-206.seicom.net>
Ronald J Kimball <rjk@coos.dartmouth.edu> wrote:
> Joergen W. Lang wrote:
> >
> > David C McCall <cyberman@sonoma.edu> writes:
> >
> > > I've got 2 files each with the same number of lines of text.
> > > I would like to merge these files line by line appending the
> > > 2nd files 1st line to the 1st files 1st line, and so on....to
> > > a 3rd file.....
> >
> > [snipped:
> > program which reads both files into arrays
> > creates a third array merging the contents of the first two arrays
> > and then prints that array out to the new file]
>
> Could you possibly do that any less efficiently?!
>
> Not only are you unnecessarily storing the contents of both original files in
> memory, you're *duplicating* the contents of the files in the third array.
> What's wrong with reading in a line from each original file and printing them
> out directly?
>
> BTW, you also ignored the specification to append the lines together. You
> need to remove the newlines from the first file.
OK, let me try again, please:
#!/usr/bin/perl -w
# marge.pl Vs.1.1.
#
# Takes two text files and merges them into
# one new file:
# line1 of file1 line1 of file2 \n
# line2 of file1 line2 of file2 \n etc...
#
# Author: Joergen W. Lang (joergen.lang@schwaben.de)
# Date: 03/30/98
#
# Thanks to R.J. Kimball for pointing out a few things about
# efficiency to me. :-)
$path_to_file_1 = "file_1";
$path_to_file_2 = "file_2";
$path_to_newfile = "newfile";
open FILE_1, $path_to_file_1 or die "Ave Caesar: $!";
open FILE_2, $path_to_file_2 or die "Morituri te salutant: $!";
open NEWFILE, ">$path_to_newfile" or die "Carpe die m: $!";
OUTER: while (<FILE_1>) {
chomp;
print NEWFILE;
while (<FILE_2>) {
print NEWFILE;
next OUTER;
}
}
close FILE_1;
close FILE_2;
close NEWFILE;
# End of marge.pl
Better ?
Joergen
--
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
-------------------------------------------------------------------
------------------------------
Date: Tue, 31 Mar 1998 00:31:51 GMT
From: yoboseyo42@hotmail.com (yoboseyo)
Subject: Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ
Message-Id: <6fnlhi$504$1@newsreader.omen.com.au>
I hate reading or viewing news reports about the 'YEAR 2000 BUG" argh
run and scream effects excluded here. One lengthy document wrote of
hospital machines which would not work after the year 2000. Hmm, I
thought, I have a friend who likes to mess about with basic. Maybe I
will write him a basic prog based on this and see if he can make a
fix.
I wanted to include the article with the routine but I could not write
a 2000 bug into this simple maintenance checking routine as described.
The machine would never "stop working suddenly and kill someone",
rather it would have to wait more than a century before it stopped and
requested maintenance checking!
Point being, sensationalism! This guy knew nuts about what he wrote.
The problem is there, but misunderstood! Journalists should write news
while programmers should make use of all that storage space and ram so
that the journalist can keep reporting the news.
By the way, nicely researched letter you created. Also, I NEVER wrote
a program which contained the "milenium bug" ( which is so stupid!!!!
its a bloody century bug!!! argh!!!). I wrote all programs on an amiga
which uses seconds since their 'incept date' 1st Jan 1979. (yes,
that's a fact jack!) So, how many years in 28 bits worth of seconds?
(4 bits for 16ths of a second...)
Zooko Journeyman <zooko@xs4all.nl> wrote:
>[Greetings, Usenetters. This is an article i've just hacked up
>that i intend to send to reporters and publications when i read
>that the year 2000 bug is caused by legacy programs. I argue
>that a "sizeable fraction" of y2k bugs were written in the
>1990's, and i attempt to start a trend of calling them "y2k
>bugs" instead of "The Y2k Bug" since there are many of them and
>they come in many different flavors and they must be fixed
>individually. All flames, compliments, comments, criticisms,
>questions and answers are welcome at "zooko@xs4all.nl". --Z]
yoboseyo42@hotmail.com
Member of The HTML Writers Guild
http://www.hwg.org/
--------------------------------
http://members.xoom.com/ubc Join the Clans
http://www.omen.com.au/~dion/award Get awarded
------------------------------
Date: Mon, 30 Mar 1998 12:56:22 +0100
From: Nicholas Kitchener <KitchenerN@Logica.com>
Subject: Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ
Message-Id: <351F8866.4FAF@Logica.com>
yoboseyo wrote:
>
> I hate reading or viewing news reports about the 'YEAR 2000 BUG" argh
> run and scream effects excluded here. One lengthy document wrote of
> hospital machines which would not work after the year 2000. Hmm, I
> thought, I have a friend who likes to mess about with basic. Maybe I
> will write him a basic prog based on this and see if he can make a
> fix.
> I wanted to include the article with the routine but I could not write
> a 2000 bug into this simple maintenance checking routine as described.
> The machine would never "stop working suddenly and kill someone",
> rather it would have to wait more than a century before it stopped and
> requested maintenance checking!
>
> Point being, sensationalism! This guy knew nuts about what he wrote.
>
> The problem is there, but misunderstood! Journalists should write news
> while programmers should make use of all that storage space and ram so
> that the journalist can keep reporting the news.
>
> By the way, nicely researched letter you created. Also, I NEVER wrote
> a program which contained the "milenium bug" ( which is so stupid!!!!
> its a bloody century bug!!! argh!!!). I wrote all programs on an amiga
> which uses seconds since their 'incept date' 1st Jan 1979. (yes,
> that's a fact jack!) So, how many years in 28 bits worth of seconds?
> (4 bits for 16ths of a second...)
Well everyone assumes that you've got the whole of 1999 to do the
fixes..
not true - especially if your system provides fiscal/future trends/
prediction.
In this case you may even already have problems or you will have in
about 8 months time as many programs look a year ahead.
Most people jump up and down about hardware- they forget the business
logic that looks into the future.
Nick.
--
Nicholas Kitchener, Software Engineer, Logica UK
------------------------------
Date: Mon, 30 Mar 1998 12:19:36 GMT
From: tim.hall@spam.begone (Tim Hall)
Subject: Re: The "Y2k-bugs-are-not-just-a-legacy-problem" FAQ
Message-Id: <351f8ca5.3698288@69.0.9.9>
On Mon, 30 Mar 1998 12:56:22 +0100, Nicholas Kitchener
<KitchenerN@Logica.com> wrote:
>Well everyone assumes that you've got the whole of 1999 to do the fixes..
>not true - especially if your system provides fiscal/future trends/
>prediction.
>
>In this case you may even already have problems or you will have in
>about 8 months time as many programs look a year ahead.
>
>Most people jump up and down about hardware- they forget the business
>logic that looks into the future.
>
>Nick.
>--
>Nicholas Kitchener, Software Engineer, Logica UK
I ran into the so-called Millenium bug more than ten years ago in an
industrial maintenance system, when calculating next overhaul dates
for machinery, and thought they were 80 years overdue. Our end-user
complained that his system was "posessed by the spirit of an negilgent
Edwardian maintenance engineer".
We hit the 1900 bug as well with another customer, who had equipment
installed in the *last* century that was still in use.
Tim Hall, Indus International (was TSW International)
tim.hall (at) iint.com
http://www.indusworld.com
Replace domain name with the iint.com before replying via email!
------------------------------
Date: 30 Mar 1998 08:18:11 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: verifying email address -- how?
Message-Id: <slrn6hula3.fua.Tom.Grydeland@mitra.phys.uit.no>
On Sat, 28 Mar 1998 23:06:30 -0500,
I R A Aggie <fl_aggie@thepentagon.com> wrote:
> But let us drop down to the bottom line, here: what is the cost/benefit
> ratio to checking an email address? IMHO, not terribly high. In fact,
> its so low as to become a worthless endeavor.
Nitpick:
If the cost/benefit ratio is low, that should mean it's worth while
doing, right?
> James
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
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 2207
**************************************