[24811] in Perl-Users-Digest
Perl-Users Digest, Issue: 6964 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 5 18:06:24 2004
Date: Sun, 5 Sep 2004 15:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 5 Sep 2004 Volume: 10 Number: 6964
Today's topics:
Re: Burned using the .. operator (J. Romano)
Dynamic hash names <joericochuyt@msn.com>
Re: Dynamic hash names <mritty@gmail.com>
Frontier::RPC security <lepi_MAKNI_ME_@fly.srk.fer.hr>
Interface between C and Perl <lepi_MAKNI_ME_@fly.srk.fer.hr>
Re: Interface between C and Perl <postmaster@castleamber.com>
Re: Interface between C and Perl <nospam@nospam.com>
Re: multiple regex pattern matching per line? (Anno Siegel)
net::ftp errors <noreply@nowhere.com>
Re: net::ftp errors <mritty@gmail.com>
Re: net::ftp errors <noreply@nowhere.com>
Re: net::ftp errors <mritty@gmail.com>
Re: packing floats? (Anno Siegel)
Re: Sending vars from Perl to PHP <noreply@gunnar.cc>
Re: Sending vars from Perl to PHP <joericochuyt@msn.com>
Re: Sending vars from Perl to PHP <jurgenex@hotmail.com>
Re: Sending vars from Perl to PHP <tadmc@augustmail.com>
Re: Sending vars from Perl to PHP <noreply@gunnar.cc>
Re: Sending vars from Perl to PHP (krakle)
Temporarily redirecting STDOUT <fil@nospam.thanks>
Re: Temporarily redirecting STDOUT <nobull@mail.com>
Re: Temporarily redirecting STDOUT <fil@nospam.thanks>
Re: Update multiple lines in a flat file from array (dan baker)
Re: Update multiple lines in a flat file from array <ebohlman@omsdev.com>
Re: Xah Lee's Unixism <prep@prep.synonet.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 5 Sep 2004 10:37:57 -0700
From: jl_post@hotmail.com (J. Romano)
Subject: Re: Burned using the .. operator
Message-Id: <b893f5d4.0409050937.4d49a118@posting.google.com>
Ala Qumsieh <notvalid@email.com> wrote in message news:<w1v_c.15996$JU4.8809@newssvr27.news.prodigy.com>...
>
> Short-circuiting is very useful and ubiquitous in Perl. Have you never
> used the following idiom:
>
> open my $fh, $file or die $!;
>
> ? Short-circuiting is what prevents the die() from executing if the
> open() succeeds.
Oh, yes, I've used that all the time. I happen to find
short-circuit evaluation very useful (especially when handling C
strings). But this was a case where I got stung by it because I was
treating the .. operator like a "between" operator, instead of a
"flip-flop" operator.
> J. Romano wrote:
> >
> > Anytime you type a line like this (that contains the .. or the ...
> > operator) in the debugger:
> >
> > print "True" if m/BEGIN/ .. m/END/;
> >
> > it is essentially the same as the line:
> >
> > print "True" if m/BEGIN/;
>
> I don't understand what you mean here. The following two lines are
> different:
>
> print "True" if /BEGIN/ .. /END/;
> print "True" if /BEGIN/;
That's part of my point. They certainly look different, but they
behave the same WHEN TYPED INTO THE DEBUGGER. If you don't believe
me, try it out yourself. Here, I made a sample program that you can
try out (explanation follows):
#!/usr/bin/perl -w
use strict;
$| = 1; # autoflush
while (<DATA>)
{
last if m/^__END__$/;
print "At line $.: $_";
if (m/BEGIN/ .. m/END/) # set breakpoint here (line 11)
{
print ".. operator returned true\n";
}
}
__DATA__
1
2
3 BEGIN
4
5
6 END
7
8
9
__END__
Save this program to a file named "dotdot.pl" and start the
debugger with the command:
perl -d dotdot.pl
Then set a breakpoint at line 11 with the command "b 11". Then type
"c" to start the program. As you go through the program with the "c"
command, the first three lines behave exactly as you'd expect,
returning true only for the third line.
But the fourth time you hit that breakpoint, don't continue.
Instead, type out the condition yourself, with a line like:
print "True" if (m/BEGIN/ .. m/END/)
Will it print "True"? Many people would think so, because the fourth
line falls between the BEGIN and END lines. But if you try it out, it
doesn't print "True"! Strangely enough, if you hit "n" in the
debugger to advance to the next line, it will go into the block, as if
the condition "m/BEGIN/ .. m/END/" evaluated to true!
So what is going on? Well, like I said in a previous post, the
following two lines are equivalent when typed into the debugger:
print "True" if /BEGIN/ .. /END/;
print "True" if /BEGIN/;
I have already explained why, but because apparently this isn't
intuitive, I'll explain it again:
Each instance of the .. and ... operators (in scalar context)
maintains its own state. If identical .. conditions happen more than
once in a script their states will be independent of each other,
meaning that one .. condition could return true and another could
return false, even if they look identical. That also means that every
time you type a condition with a .. operator in the debugger it will
use its own state, and act like it was invoked for the very first
time, making the condition "if (m/BEGIN/ .. m/END/)" behave the same
as "if (m/BEGIN/)".
(Like I said before, test this in the debugger if you don't believe
me. Try to find an instance where the above two lines won't evaluate
to the same thing when typed one after the other in the debugger.)
If you think this is confusing, you're not alone. I took me a
while to find this, which is why I originally thought this was a bug
in Perl. But it's not a bug in Perl -- it's behaving exactly as it
should. It's not intuitive (at least not to me), which is exactly the
reason I got stung.
So that's why I'm sharing it here -- so that others who use the ..
and ... operators with short-circuit evaluation won't think they are
going crazy when the debugger logic seems to be contradicting the
logic written in the script.
-- Jean-Luc
------------------------------
Date: Sun, 05 Sep 2004 17:48:29 -0400
From: "yusufdestina" <joericochuyt@msn.com>
Subject: Dynamic hash names
Message-Id: <06392a5164efd1a62c1eacef184634da@localhost.talkaboutprogramming.com>
Hi all,
I'm a php man bussy learning Perl...
I found the following problem. I'm getting some filenames from a
directory. Those names are stored in a array
@files = ('test1','test2','test3');
Each file has 3 lines of content.
name=>'blablabla'
age=>'blablabla'
score=>'blalala'
I want to make hashes witch have the names of @files
ex. %test1 %test2 %test3
and store the content of that file in the hash.
-----------------------------------------------------------
$count = scalar(@files);
for ($i=0; $i< $count; $i++){
open (PROFILE, @files[$i]);
while(<PROFILE>){
push("@profile.$i", $_);#WRONG
print "$_";
}
close (PROFILE);
}
-----------------------------------------------------------
The final idee is to have something like this:
%test1=(name=>'blbla',age=>'blala',score=>'qsdf');
%test2=(name=>'blbla',age=>'blala',score=>'qsdf');
any help is appreciated.
------------------------------
Date: Sun, 05 Sep 2004 17:58:38 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Dynamic hash names
Message-Id: <chg27b$4d2$2@misc-cct.server.rpi.edu>
yusufdestina wrote:
> Hi all,
> I'm a php man bussy learning Perl...
I think learning PHP is kinda like being hit by a bus, but regardless...
> I found the following problem. I'm getting some filenames from a
> directory. Those names are stored in a array
> @files = ('test1','test2','test3');
> Each file has 3 lines of content.
> name=>'blablabla'
> age=>'blablabla'
> score=>'blalala'
> I want to make hashes witch have the names of @files
No you don't.
This is called symbollic references. This is a bad idea. For why this
is a bad idea, google this newsgroup for "symbolic references" or
"symrefs".
For what you *actually* want to do, read Perl's FAQ by typing into your
command line:
perldoc -q "variable name"
Paul Lalli
------------------------------
Date: Sun, 05 Sep 2004 17:19:06 +0200
From: lepi <lepi_MAKNI_ME_@fly.srk.fer.hr>
Subject: Frontier::RPC security
Message-Id: <chfakd$vh1$2@bagan.srce.hr>
Hi
I read somewhere that it can be done with https. What steps do I need to
take to make it run?? What changes should be madeon server, and what on
client? Do I need Crypt-SSLeay??
Thanks
------------------------------
Date: Sun, 05 Sep 2004 17:15:26 +0200
From: lepi <lepi_MAKNI_ME_@fly.srk.fer.hr>
Subject: Interface between C and Perl
Message-Id: <chfakc$vh1$1@bagan.srce.hr>
Hello,
I have a problem interfacing C and Perl. I have program written in C
that acts like a daemon, and Perl program (also a daemon) that should
interact with C program. Program in Perl should be the bridge from a
remote client to C server program.(C and Perl programs are on one
computer, and lient on remote). C program has input and output that has
to be passed through Perl server, and client should be able to control C
server. The main problem is that C client needs to pass some options to
C server, an based on that options, C server will be started, and after
that client and C server can comunicate with help of the Perl bridge
program.
Is there a way that I could do it??
Thank you for any advice
Tom
------------------------------
Date: 5 Sep 2004 17:10:36 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Interface between C and Perl
Message-Id: <Xns955B7BDC88BCBcastleamber@130.133.1.4>
lepi <lepi_MAKNI_ME_@fly.srk.fer.hr> wrote in news:chfakc$vh1$1
@bagan.srce.hr:
> Hello,
>
> I have a problem interfacing C and Perl. I have program written in C
> that acts like a daemon, and Perl program (also a daemon) that should
> interact with C program. Program in Perl should be the bridge from a
> remote client to C server program.(C and Perl programs are on one
> computer, and lient on remote). C program has input and output that has
> to be passed through Perl server, and client should be able to control C
> server. The main problem is that C client needs to pass some options to
> C server, an based on that options, C server will be started, and after
> that client and C server can comunicate with help of the Perl bridge
> program.
>
> Is there a way that I could do it??
Yes, read the documentationt that comes with Perl. perldoc perlipc
for example.
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Sun, 05 Sep 2004 20:16:18 GMT
From: "Dick" <nospam@nospam.com>
Subject: Re: Interface between C and Perl
Message-Id: <muK_c.8220$w%6.4183@newsread1.news.pas.earthlink.net>
"lepi" wrote:
> I have a problem interfacing C and Perl.
<snip>
> C server, an based on that options, C server will be started, and after
> that client and C server can comunicate with help of the Perl bridge
> program.
>
> Is there a way that I could do it??
Four years ago I used "swig" for that purpose:
http://www.swig.org
Like the gentleman said, check out the perl documentation (if you have time)
and check CPAN for any modules that could help. CPAN is your friend.
------------------------------
Date: 5 Sep 2004 13:16:01 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: multiple regex pattern matching per line?
Message-Id: <chf3ih$s7s$1@mamenchi.zrz.TU-Berlin.DE>
Tad McClellan <tadmc@augustmail.com> wrote in comp.lang.perl.misc:
> Darius <dmedhora@yahoo.com> wrote:
[...]
> > Please help urgently.
>
>
> If it is urgent, then Usenet is the wrong place to go!
...but if you do, pleading urgency is unwise. You might as well jump up
and down waving your arms in a crowd. It will win you about as much
sympathy.
Anno
------------------------------
Date: Sun, 05 Sep 2004 21:01:06 GMT
From: Shailesh Humbad <noreply@nowhere.com>
Subject: net::ftp errors
Message-Id: <m8L_c.305971$fv.134602@fe2.columbus.rr.com>
How can I get the error codes and descriptions when net::ftp methods fail?
For example:
unless($ftp->put($filename)) {
print("Error uploading file to the FTP server. why?");
exit();
}
------------------------------
Date: Sun, 05 Sep 2004 17:17:54 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: net::ftp errors
Message-Id: <chfvqv$48q$1@misc-cct.server.rpi.edu>
Shailesh Humbad wrote:
> How can I get the error codes and descriptions when net::ftp methods fail?
>
> For example:
>
> unless($ftp->put($filename)) {
> print("Error uploading file to the FTP server. why?");
> exit();
> }
Have you tried reading the documentation for the module you're using?
The answer is given in the synopsis, at the very beginning of the
documentation...
perldoc Net::FTP
Paul Lalli
------------------------------
Date: Sun, 05 Sep 2004 21:38:21 GMT
From: Shailesh Humbad <noreply@nowhere.com>
Subject: Re: net::ftp errors
Message-Id: <hHL_c.306151$fv.146522@fe2.columbus.rr.com>
Paul Lalli wrote:
> Shailesh Humbad wrote:
>
>> How can I get the error codes and descriptions when net::ftp methods
>> fail?
>>
>> For example:
>>
>> unless($ftp->put($filename)) {
>> print("Error uploading file to the FTP server. why?");
>> exit();
>> }
>
>
> Have you tried reading the documentation for the module you're using?
> The answer is given in the synopsis, at the very beginning of the
> documentation...
>
> perldoc Net::FTP
>
> Paul Lalli
Yeah, I just found it. Unfortunately, I had been using Google to get
the documentation, and the page I ended up at was old. Search for
"perldoc net::ftp" in Google and click on the first link, and you will
see no mention of the $ftp->message variable. It is the perldoc site,
which one would think is authoritative. Finally, I found a link to
the better CPAN docs through another link in experts-exchange.
So what is the best site for perl documentation?
------------------------------
Date: Sun, 05 Sep 2004 17:56:16 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: net::ftp errors
Message-Id: <chg22t$4d2$1@misc-cct.server.rpi.edu>
Shailesh Humbad wrote:
> Unfortunately, I had been using Google to get
> the documentation, and the page I ended up at was old. Search for
> "perldoc net::ftp" in Google and click on the first link, and you will
> see no mention of the $ftp->message variable. It is the perldoc site,
> which one would think is authoritative. Finally, I found a link to the
> better CPAN docs through another link in experts-exchange.
>
> So what is the best site for perl documentation?
>
The best resource is using the documentation that came with your
installation of Perl. Type the command
perldoc Net::FTP
at your command prompt.
For a lesson on using the perldoc program, type
perldoc perldoc
For a list of all the available documentations, type
perldoc perltoc
Paul Lalli
------------------------------
Date: 5 Sep 2004 13:25:11 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: packing floats?
Message-Id: <chf43n$s7s$2@mamenchi.zrz.TU-Berlin.DE>
Mike <mikee@mikee.ath.cx> wrote in comp.lang.perl.misc:
> In article <x7pt51jt7x.fsf@mail.sysarch.com>, Uri Guttman wrote:
> >>>>>> "M" == Mike <mikee@mikee.ath.cx> writes:
> >
> ><snip of whole quote. please learn to edit>
> >
> > M> What I'm looking for is equal to:
> >
> > M> int i;
> > M> float f[18];
> > M> for(i = 0; i < 18; i++) {
> > M> f[i] = genome[i];
> > M> }
> >
> > and did you see my post about pack 'd'?
> >
> > uri
> >
>
> Yes, but I didn't find the 'd' in 'perldoc -f pack'.
> Did I miss it here or should I look someplace else?
Look again.
Anno
------------------------------
Date: Sun, 05 Sep 2004 15:14:04 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Sending vars from Perl to PHP
Message-Id: <2q0ic8Fpov0uU1@uni-berlin.de>
yusufdestina wrote:
> I want to send some vars from Perl to a php script on my server and
> execute the php script.
> This is what i have:
> Perl script:
> ------------
> print "Value to send: ";
> $value= <STDIN>;
> print "Sending $value to localhost\n";
> $url = "http://localhost/testPerl.php?test=$value";
> ------------
> PHP script:
> ------------
> <?php
> $received = $_GET['test'];
> print "Value received: $received";
> ?>
You don't send variables, you send data. If it is sufficient to pass
the data via a GET request, you can run the Perl program as a CGI
script and redirect to the PHP program:
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
my $q = new CGI;
my $value = $q->param('test');
my $url = "http://localhost/testPerl.php?test=$value";
print $q->redirect($url);
See "perldoc CGI".
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 05 Sep 2004 09:59:36 -0400
From: "yusufdestina" <joericochuyt@msn.com>
Subject: Re: Sending vars from Perl to PHP
Message-Id: <060b5dc08018d6e607a0d9aba3ef4351@localhost.talkaboutprogramming.com>
tnx a lot! I found also this solution:
------------------------------------------------------------
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->agent("MyApp/0.1 ");
my $req = HTTP::Request->new(POST => 'http://localhost/testPerl.php');
$req->content_type('application/x-www-form-urlencoded');
$req->content('yusuf=test');
my $res = $ua->request($req);
if ($res->is_success) {
print $res->content;
}
else {
print $res->status_line, "\n";
}
------------------------------
Date: Sun, 05 Sep 2004 14:14:14 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Sending vars from Perl to PHP
Message-Id: <WaF_c.2109$x12.1660@trnddc05>
yusufdestina wrote:
> I want to send some vars from Perl to a php script on my server and
> execute the php script.
Are you looking for the LWP module by any chance?
jue
------------------------------
Date: Sun, 5 Sep 2004 09:30:58 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Sending vars from Perl to PHP
Message-Id: <slrncjm8p2.tom.tadmc@magna.augustmail.com>
yusufdestina <joericochuyt@msn.com> wrote:
> I want to send some vars from Perl to a php script
You cannot send variables, you can send _values_ though.
> on my server and
> execute the php script.
perldoc -q HTML
How do I fetch an HTML file?
How do I automate an HTML form submission?
and
perldoc -q CGI
might be helpful too.
> print "Value to send: ";
> $value= <STDIN>;
chomp $value; # don't want a newline in the URL
> print "Sending $value to localhost\n";
^^
^^
Didn't your program's output look a little funny right about here?
> $url = "http://localhost/testPerl.php?test=$value";
use LWP::Simple;
my $response = get $url;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 05 Sep 2004 18:17:01 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Sending vars from Perl to PHP
Message-Id: <2q0sghFpigh3U1@uni-berlin.de>
yusufdestina wrote:
> tnx a lot! I found also this solution:
> ------------------------------------------------------------
> use LWP::UserAgent;
> $ua = LWP::UserAgent->new;
> $ua->agent("MyApp/0.1 ");
> my $req = HTTP::Request->new(POST => 'http://localhost/testPerl.php');
> $req->content_type('application/x-www-form-urlencoded');
> $req->content('yusuf=test');
> my $res = $ua->request($req);
> if ($res->is_success) {
> print $res->content;
> }
> else {
> print $res->status_line, "\n";
> }
Okay. For some reason I thought that you wanted to have the PHP
program finish the process, and not send its output to the Perl
program. You should view the redirect idea in the light of that.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 5 Sep 2004 14:39:26 -0700
From: krakle@visto.com (krakle)
Subject: Re: Sending vars from Perl to PHP
Message-Id: <237aaff8.0409051339.767f386@posting.google.com>
"yusufdestina" <joericochuyt@msn.com> wrote in message news:<93f58ca8c95f055b703b557e8c1d1049@localhost.talkaboutprogramming.com>...
> Hi folks..
> simple question, but to much for me :(
> I want to send some vars from Perl to a php script on my server and
> execute the php script.
What is involved that requires you to send variable values from a Perl
script to a PHP script?
------------------------------
Date: Sun, 05 Sep 2004 22:43:55 +0200
From: Fil <fil@nospam.thanks>
Subject: Temporarily redirecting STDOUT
Message-Id: <pan.2004.09.05.20.43.54.227064@nospam.thanks>
Hi,
I'm writing some Perl (5.8.2) routines on Windows 2000. One of these
routines calls RCS functions like this:
$command = "rcs -x${rcssfx} -l $rcsname";
$rc = system($command);
I'm logging and printing my own error diagnostics, so I'm a little annoyed
that RCS prints to screen what it's doing. I'd like to redirect STDOUT
just for this command.
I understand that I can use open2 or open3 and collect separately the
STDOUT, STDERR and the return code and solve the problem. I'm really
interested here in learning to redirect STDOUT and of course recover it
afterwards. On Unix I'd redirect it to /dev/null... is there anything like
it for Perl on Windows?
Thanks in advance!
Fil
------------------------------
Date: Sun, 05 Sep 2004 22:25:23 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Temporarily redirecting STDOUT
Message-Id: <chg084$1g2$1@slavica.ukpost.com>
Fil wrote:
> On Unix I'd redirect it to /dev/null... is there anything like
> it for Perl on Windows?
This is a question about Windows not Perl.
IIRC the null device on Windows is called NUL:
But then again this is a Perl newsgroup not a Windows one so you shoud
not expect to find Windows expertease here.
OBperl: File::Spec->devnull :-)
------------------------------
Date: Sun, 05 Sep 2004 23:40:12 +0200
From: Fil <fil@nospam.thanks>
Subject: Re: Temporarily redirecting STDOUT
Message-Id: <pan.2004.09.05.21.40.11.629550@nospam.thanks>
Hi,
>> On Unix I'd redirect it to /dev/null... is there anything like it for
>> Perl on Windows?
>
> This is a question about Windows not Perl.
Fair enough, but that was not my main question.
> IIRC the null device on Windows is called NUL:
Thanks.
> But then again this is a Perl newsgroup not a Windows one so you shoud
> not expect to find Windows expertease here.
As I said, that was an aside. The post was to know how to redirect STDOUT
temporarily, then recover it.
Thanks!
Fil
------------------------------
Date: 5 Sep 2004 11:58:43 -0700
From: botfood@yahoo.com (dan baker)
Subject: Re: Update multiple lines in a flat file from array
Message-Id: <13685ef8.0409051058.4a813363@posting.google.com>
"blnukem" <bill@hotmail.com> wrote in message news:<Y2i_c.5572$lv3.3194761@news4.srv.hcvlny.cv.net>...
> Hi All
>
> I looking for a simple way to update multiple lines in a flat file from
> incoming array with multiple values the file structure goes like this:
> Part-number | Name | Quantity
>
> The file looks like this:
>
> 123456|headlamp|6
> -----------------------------------------
this looks like a pretty good candidate to use a tie()ed hash DBfile
rather than a flat text file read in and out.... Be a lot faster and
use less memory probably.
If you insist on a flat text file, and its not *huge* I guess you
could read it all into a hash in memory, do your thing, and then write
it all back out (overwriting the old file).
d
------------------------------
Date: 5 Sep 2004 22:03:49 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Update multiple lines in a flat file from array
Message-Id: <Xns955BAE75BB06Febohlmanomsdevcom@130.133.1.4>
botfood@yahoo.com (dan baker) wrote in
news:13685ef8.0409051058.4a813363@posting.google.com:
> "blnukem" <bill@hotmail.com> wrote in message
> news:<Y2i_c.5572$lv3.3194761@news4.srv.hcvlny.cv.net>...
>> Hi All
>>
>> I looking for a simple way to update multiple lines in a flat file
>> from incoming array with multiple values the file structure goes like
>> this: Part-number | Name | Quantity
>>
>> The file looks like this:
>>
>> 123456|headlamp|6
>> -----------------------------------------
>
> this looks like a pretty good candidate to use a tie()ed hash DBfile
> rather than a flat text file read in and out.... Be a lot faster and
> use less memory probably.
>
> If you insist on a flat text file, and its not *huge* I guess you
> could read it all into a hash in memory, do your thing, and then write
> it all back out (overwriting the old file).
It also looks like a good candidate for DBD::CSV, which wouldn't require
any changes to the file format and which has the insert/delete/select
functionality already written. But if that's overkill, then Tie::File
(which is included with the standard Perl distribution) would probably be
helpful.
------------------------------
Date: Mon, 06 Sep 2004 02:32:01 +0800
From: Paul Repacholi <prep@prep.synonet.com>
Subject: Re: Xah Lee's Unixism
Message-Id: <871xhgh8im.fsf@k9.prep.synonet.com>
Nick Landsberg <SPAMhukolauTRAP@SPAMworldnetTRAP.att.net> writes:
>> Indeed, it could have failed in a way entirely unique to
>> itself... :) The O-Ring thing had been identified, was preventable
>> and should have been prevented. Sure, perhaps the design did suck,
>> but the point is the whole disaster was trivially avoidable if the
>> people running the show were willing to grasp the nettle.
> Since we're so far off-topic here anyway ...
> It has been so many years since the Challenger disaster that memory
> fades (especially at my age), so bear with me if a misremember
> something.
> As I recall, the particular launch happened during an unusual cold
> spell in Florida. I also recall that the investigation uncovered
> strong recommendations by several senior engineers, prior to launch,
> that the launch should be postponed because the system (shuttle and
> boosters) had never been launched during those kinds of weather
> conditions. (It could very well be that they might have pointed out
> the O-rings specifically, but I don't recall.) Some
> managementcritter at some level (probably in NASA) ignored or
> overruled those recommendations. I can only conjecture that this
> was because that the prevailing culture (in most corporations, then
> and now) is "we have to meet our schedules."
Grab a copy of `Genius', Gleiks bio of RF and read the end chapters
and note what was `leaked' to him.
Before the launch, it was known that they where colder than any
previous launch, and that the seal erosion problems they worried about
where wose in colder conditions.
The engineers wanted to holdm but that would have meant Ronny Raygun
could not grandstand on TV, so N.A.S.A.
--
Paul Repacholi 1 Crescent Rd.,
+61 (08) 9257-1001 Kalamunda.
West Australia 6076
comp.os.vms,- The Older, Grumpier Slashdot
Raw, Cooked or Well-done, it's all half baked.
EPIC, The Architecture of the future, always has been, always will be.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 6964
***************************************