[13728] in Perl-Users-Digest
Perl-Users Digest, Issue: 1138 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 21 06:05:41 1999
Date: Thu, 21 Oct 1999 03:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940500311-v9-i1138@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 21 Oct 1999 Volume: 9 Number: 1138
Today's topics:
Associative Array <umungo01@shafika.vetri.com>
Re: Associative Array (Michael Budash)
Card shuffling (Anno Siegel)
Re: File "cgi-lib.pl" not found in @INC? (David Efflandt)
Re: File "cgi-lib.pl" not found in @INC? KernelKlink@webtv.net
file upload <ab@cd.com>
flcoking a DBM <thebravo@netzero.net>
Formating text <jphil@act.oda.fr>
Re: Ignore the idiots (including Tad) <nick.condon@tamesis.com>
Re: Ignore the idiots <msm@manley.org>
Re: Ignore the idiots <nick.condon@tamesis.com>
Re: Ignore the idiots <gellyfish@gellyfish.com>
Re: IP address <rhomberg@ife.ee.ethz.ch>
OT: Why German? was: Wall Street E-Commerce <azielke@hotmail.com>
Re: Perl parser / brackets in C language sintes@my-deja.com
Process Locking <dean@contender.cain.net.au>
Re: Process Locking (Martien Verbruggen)
Re: Process Locking <dean@contender.cain.net.au>
Re: Process Locking (Martien Verbruggen)
Re: subroutine <ltl@rgsun40.viasystems.com>
Re: subroutine (Craig Berry)
Re: Substitution <lr@hpl.hp.com>
Re: Trim text sushi38@my-deja.com
Re: Unix code to perl (Neko)
Re: Wall Street E-Commerce <ltl@rgsun40.viasystems.com>
Re: Wall Street E-Commerce (Martien Verbruggen)
Re: Wall Street E-Commerce (Craig Berry)
Re: Wall Street E-Commerce <gellyfish@gellyfish.com>
Win32 install problem <yduplaix@netscape.com>
Win32 install problem <yduplaix@netscape.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 21 Oct 1999 06:45:04 GMT
From: Govindaraj <umungo01@shafika.vetri.com>
Subject: Associative Array
Message-Id: <s0tdjgatr0132@corp.supernews.com>
Hi,
I just like to know this...!!! Sorry, I am not able to find this in any
perl references.....!!!
I have Perl Script like below:
=====================================
%Year = ( "Jan" => "One", "Feb" => "Two", "Mar" => "Three", "April" =>
"Four" );
while ( ($key, $value) = each ( %Year ) )
{
print "Key : $key\n";
print "Value : $value\n";
}
Output:
=======
Key : April
Value : Four
Key : Mar
Value : Three
Key : Jan
Value : One
Key : Feb
Value : Two
=====================================
Why I cannot get the Output in the order I have give in the
Associative Array...why like this....not seems to be reverse order
also...how the perl working on the Associate Array....kidding....!!!
Regards,
Govindaraj M.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Thu, 21 Oct 1999 01:00:11 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Associative Array
Message-Id: <mbudash-2110990100110001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>
In article <s0tdjgatr0132@corp.supernews.com>, Govindaraj
<umungo01@shafika.vetri.com> wrote:
>
>=====================================
>%Year = ( "Jan" => "One", "Feb" => "Two", "Mar" => "Three", "April" =>
>"Four" );
>
>
>while ( ($key, $value) = each ( %Year ) )
>{
> print "Key : $key\n";
> print "Value : $value\n";
>}
>
>Output:
>=======
>Key : April
>Value : Four
>Key : Mar
>Value : Three
>Key : Jan
>Value : One
>Key : Feb
>Value : Two
>
>=====================================
>
>Why I cannot get the Output in the order I have give in the
>Associative Array...why like this....not seems to be reverse order
>also...how the perl working on the Associate Array....kidding....!!!
that's just the way hashes work. however, per the "Perl Cookbook", if you
do this:
use Tie::IxHash;
tie %Year, "Tie::IxHash";
it will work as you request. it's a cool module...
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: 21 Oct 1999 09:45:33 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Card shuffling
Message-Id: <7umnbt$nki$1@lublin.zrz.tu-berlin.de>
Kragen Sitaker <kragen@dnaco.net> wrote in comp.lang.perl.misc:
>In article <380DE396.CA7A3F34@ife.ee.ethz.ch>,
>Alex Rhomberg <rhomberg@ife.ee.ethz.ch> wrote:
>>The problem is that your random generator allows only for 2^32
>>possibilites, while shuffling the cards can have much much more (see the
>>zeroes above for the relation)
>>
>>Mathematica says:
>>52!/46! > 2^33
>>
>>meaning that if you take *six* cards with your method and a 32 bit
>>random generator, _all_ the remaining cards are _known_. (it can vary.
>>some deals might be unique after less cards, some might differ after
>>more)
>>After the first *six* cards, all the randomness has gone out of your
>>method!
>
>Good point. This is probably something to think about if you want your
>card shuffles to be fair. (It's probably possible, given the simple
>algorithms rand() uses, for an attacker to figure out what the rest of
>the deck is by looking at any six cards.)
If predictability from the first few cards is a problem (there may
be situations where it would), you can re-seed the generator every
so-many cards. Just how sophisticated you are about choosing the
seed depends on what is at stake.
More generally, why is the fact that a random generator is unable
to produce all permutations of a deck so worrisome? It will still
draw a representative sample of all permutations, and a big enough
sample to last for a lifetime. After all, when you buy a real deck
of cards and start playing, you won't produce all possible
permutations either. No-one frets about that.
Anno
------------------------------
Date: 21 Oct 1999 03:12:51 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: File "cgi-lib.pl" not found in @INC?
Message-Id: <slrn80t16l.9l.efflandt@efflandt.xnet.com>
On Thu, 21 Oct 1999 02:01:23 GMT, Thomas j. Evans <thomas@skyweb.net> wrote:
>Hello.
>
>I have this Perl program that requires cgi-lib.pl, and keeps giving me
>a message saying:
>File "cgi-lib.pl" not found in @INC at line 12......
>
>cgi-lib.pl does exist in the same directory as the Perl script that is
>getting the error, and permissions are set correctly. The failing
>script starts out like this:
><snip>
@INC is the list of paths that perl searches for modules or requires.
Does yours include the current path (.) on your system (print it out and
see)? You could try "./cgi-lib.pl" or the full path to it in the require
statement.
But it would be much better to use a currently supported module like
CGI.pm than an obsolete perl 4 program.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
http://thunder.prohosting.com/~cv-elgin/
------------------------------
Date: Wed, 20 Oct 1999 23:07:26 -0400 (EDT)
From: KernelKlink@webtv.net
Subject: Re: File "cgi-lib.pl" not found in @INC?
Message-Id: <19098-380E836E-25@storefull-212.iap.bryant.webtv.net>
There may be a reference to @inc in one of your "require" files. If I
remember correctly, @inc is a way (if you are not root) to use modules
that are not installed with Perl. You install the module in your area on
the server.
==============================
Have MySQL questions but can't find a
newsgroup to post them to? Post to the newsgroup comp.databases
==============================
------------------------------
Date: Wed, 20 Oct 1999 22:13:49 -0500
From: "Blair Heuer" <ab@cd.com>
Subject: file upload
Message-Id: <7um0h3$hle$1@holly.prod.itd.earthlink.net>
I have a part in my script where files are uploaded through the web with a
form with ENCTYPE="multipart/form-data" and the type="file" tags. It appears
to work fine, but the file that is uploaded, gets corrupted, or at least
pictures get messed up, so something must be wrong. Below is the code that i
basically copy-pasted and edited to use for this function. A better way, or
what is wrong with below would be greatly appreciated.
$filePath is the file "c:/dir/file.txt" taken from the computer.
$in{'loc'} is the directory "/web/dir/" where the file is uploaded to.
----- snippet -----
sub upload() {
$|=1; # Do this to flush the input buffer each time
undef $BytesRead;
undef $Buffer;
undef @fileName;
if ($filePath eq "") {$error = "<i>No file chosen to upload.</i>"; &list;
exit; }
$thefile = $filePath;
until ($filename[0] eq "\\") {
unshift(@filename, chop($thefile));
}
shift(@filename);
foreach $each (@filename) {
$fileName .= $each;
}
open(loadedFile, ">$in{'loc'}\\$fileName");
while ($Bytes = read($filePath,$Buffer,1024)) { # Read from input buffer
(file path on client computer)
$BytesRead += $Bytes;
print loadedFile $Buffer;
}
close ($filePath);
close (loadedFile);
}
---- end snippet ----
Thanks in advance,
Blair Heuer
------------------------------
Date: Wed, 20 Oct 1999 23:42:58 -0500
From: Darrick Wolfe <thebravo@netzero.net>
Subject: flcoking a DBM
Message-Id: <380E99D2.8BE89144@netzero.net>
I was wondering if using the flock function works with DBM files? I
know how to use flock with regular files, just not sure about using it
with DBM. Would I have to flock both the .dir and .pag files? or is it
even necessary?
Any help is appreciated, along with a cc to my e-mail.
thanks again!
Darrick
------------------------------
Date: 21 Oct 1999 11:11:02 +0200
From: J-P Theberge <jphil@act.oda.fr>
Subject: Formating text
Message-Id: <87904xqdsp.fsf@godzilla.oda.fr>
Hi,
I want to take some text (coming from
a <textarea> form) and output it like
this message (i.e. with a maximum
line length and a fixed left margin).
Is there a specific module to help me
do it? Or can you give me some hints
on how to do it?
Thanks!
-jp
------------------------------
Date: Thu, 21 Oct 1999 10:36:19 +0100
From: Nick Condon <nick.condon@tamesis.com>
Subject: Re: Ignore the idiots (including Tad)
Message-Id: <380EDE93.909407EE@tamesis.com>
Tad McClellan wrote:
> Benjamin Vargas (bvargas@cmh.edu) wrote:
>
> : I would never consider hiring a consultant with an attitude such as yours.
>
> You prefer to hire consultants that *don't* adhere to 'netiquette?
>
> That is a very strange approach to business.
I wouldn't hire you either. I would insist on one that can deal with people at
all levels in a professional and courteous manner. (i.e. not you)
--
Nick Condon
------------------------------
Date: Thu, 21 Oct 1999 01:02:04 -0500
From: "Michael S. Manley" <msm@manley.org>
Subject: Re: Ignore the idiots
Message-Id: <7umaev$sbc$1@eve.enteract.com>
Nolen Johnson wondered in message <7ug1nh$1de$1@bgtnsc03.worldnet.att.net>
>Is Abigail a "he"?
>if so, why a woman's name?
Just think of the sequence of letters "Abigail" as a differentiating label,
a moiety of sorts, that lets you tell one entity in the discourse that is
Usenet from the other entities. That way you can enjoy the technical
correctness in the postings by Abigail without troubling yourself over the
dubious implication in your question that chromosomes and/or physical traits
and/or an individual's gender identification has one whit of influence over
said technical correctness.
MSM
------------------------------
Date: Thu, 21 Oct 1999 10:14:10 +0100
From: Nick Condon <nick.condon@tamesis.com>
Subject: Re: Ignore the idiots
Message-Id: <380ED962.71408EDD@tamesis.com>
Benjamin Vargas wrote:
> I think the simple and most polite way to cope with this situation is to
> ignore the posts you don't wish to read or respond to. I don't understand
> why someone would take the time to respond to a question that was posted,
> but choose to try to intimidate or belittle the person asking the question
> instead of providing useful advice. How does this help to promote the use
> and development of the Perl language?
Indeed. Nor does it reduce the amount of low-value posts this group gets, which
is what some of the elitists appear to be complaining about. However low value a
simple question may be, an abusive answer is lower.
If you think it's stupid question, bite your tongue, don't reply to it. Or if
you must abuse other posters, do it by email.
> I think some might choose not to use or learn the language if they were to
> read some of the posts in this newsgroup. I feel some of the messages
> posted do not attract Perl newbies. They don't say, "Come and try your hand
> at this wonderful language". Instead, they seem to say, "Don't you dare try
> learning Perl unless you are an experienced programmer who does not ask stupid
> questions."
I couldn't agree more. The stench of elitism is overpowering.
--
Nick Condon
------------------------------
Date: 21 Oct 1999 10:28:28 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Ignore the idiots
Message-Id: <380edcbc_1@newsread3.dircon.co.uk>
Michael S. Manley <msm@manley.org> wrote:
> Nolen Johnson wondered in message <7ug1nh$1de$1@bgtnsc03.worldnet.att.net>
>>Is Abigail a "he"?
>>if so, why a woman's name?
>
>
> Just think of the sequence of letters "Abigail" as a differentiating label,
> a moiety of sorts, that lets you tell one entity in the discourse that is
> Usenet from the other entities. That way you can enjoy the technical
> correctness in the postings by Abigail without troubling yourself over the
> dubious implication in your question that chromosomes and/or physical traits
> and/or an individual's gender identification has one whit of influence over
> said technical correctness.
>
Dont forget 'species' as well - Of course some of the postings we get from
pond slime here can usually be distinguished ....
/J\
--
"Nourishes at the root and penetrates right to the tip" - Pantene
Advertisement
------------------------------
Date: Thu, 21 Oct 1999 10:43:59 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: IP address
Message-Id: <380ED24F.D4480E5B@ife.ee.ethz.ch>
hakanogren@my-deja.com wrote:
>
> Hello.
> I would like to know how I can get the IP number from the machine where
> the script is running.
127.0.0.1 should be correct :-)
- Alex
------------------------------
Date: Thu, 21 Oct 1999 11:45:48 +0200
From: A Zielke <azielke@hotmail.com>
Subject: OT: Why German? was: Wall Street E-Commerce
Message-Id: <380EE0CC.730EF632@hotmail.com>
Craig Berry schrieb:
>
> : and Web Development
> : Talent in the country. Money is not the issue, it is the talent that
> : Wall Street is short of. The difficulty is that there is a huge
> : shortage of e-commerce talent in the Financial Sector here in New York
> : City.
>
> Was your original language German, by any chance?
>
Just out of interest (my mother-tongue is German): What makes you think
his original language is German? The capital letters? The grammar?
Andreas
------------------------------
Date: Thu, 21 Oct 1999 06:38:17 GMT
From: sintes@my-deja.com
Subject: Re: Perl parser / brackets in C language
Message-Id: <7umcco$fih$1@nnrp1.deja.com>
In article <%VHO3.14408$E_1.848528@typ11.nn.bcandid.com>,
kragen@dnaco.net (Kragen Sitaker) wrote:
> In article <7uf3a8$e6a$1@nnrp1.deja.com>, <sintes@my-deja.com> wrote:
> >I'm looking for a PERL script which allows to add a bracket
> >in all cases for the if,else,for instructions.
> >
> >for instance
> >
> >if(condition)
> > instruction
> >
> >must be changed to
> >
> >if(condition)
> > {
> > instruction
> > }
>
> This sounds like a very useful script.
>
> See my post of a few days ago about Ada parsing. You'll have to do
> something similar with C.
>
> You might be able to get away with a half-assed implementation if you
> run the C code through "indent" first. (Assuming "indent" understands
> your code correctly; it may not.)
> --
> <kragen@pobox.com> Kragen Sitaker
<http://www.pobox.com/~kragen/>
> Sun Oct 17 1999
> 23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
> <URL:http://www.pobox.com/~kragen/bubble.html>
>
I think that indent do not have option that allows to add bracket.
I thought about using PCCTS with modifying the grammar of C language
but it is too complex for this kind of operation.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 21 Oct 1999 03:39:55 GMT
From: <dean@contender.cain.net.au>
Subject: Process Locking
Message-Id: <380e8c7a@mel>
I am trying to write a script that ftps files, but only
want it to run once, ie I don't want multiple instances of it
running....
Should I be using the sysopen function to do this or is
there an easier way?
Regards
--
Dean Brandt
+-------------------------------------------------+
Cain Internet Services
Melbourne - Adelaide - Sydney - Brisbane - Bendigo
Australia
Ph/Fax: 61-3-93810595
Mobile: 0413247188
www.cain.net.au
+-------------------------------------------------+
------------------------------
Date: Thu, 21 Oct 1999 03:52:07 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Process Locking
Message-Id: <H5wP3.356$Vy1.6252@nsw.nnrp.telstra.net>
On Thu, 21 Oct 1999 03:39:55 GMT,
dean@contender.cain.net.au <dean@contender.cain.net.au> wrote:
>
> I am trying to write a script that ftps files, but only
> want it to run once, ie I don't want multiple instances of it
> running....
I would use Net::FTP and write a script, and only run it once.
> Should I be using the sysopen function to do this or is
> there an easier way?
Huh? This makes no sense to me at all... sysopen? for what? Weren't you doing
something with ftp?
Martien
--
Martien Verbruggen |
Interactive Media Division | In the fight between you and the
Commercial Dynamics Pty. Ltd. | world, back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: Thu, 21 Oct 1999 04:10:18 GMT
From: <dean@contender.cain.net.au>
Subject: Re: Process Locking
Message-Id: <380e938c@mel>
Yep, I am trying to achieve an ftp session.
Now what I am also trying to achieve is to ensure that if this process
starts, that all further attempts to run it fail until the first process
is fully completed. The script will be called from cron.
Thanks for the reply.
Martien Verbruggen <mgjv@comdyn.com.au> wrote:
> On Thu, 21 Oct 1999 03:39:55 GMT,
> I would use Net::FTP and write a script, and only run it once.
>> Should I be using the sysopen function to do this or is
>> there an easier way?
> Huh? This makes no sense to me at all... sysopen? for what? Weren't you doing
> something with ftp?
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division | In the fight between you and the
> Commercial Dynamics Pty. Ltd. | world, back the world - Franz Kafka
> NSW, Australia |
--
Dean Brandt
+-------------------------------------------------+
Cain Internet Services
Melbourne - Adelaide - Sydney - Brisbane - Bendigo
Australia
Ph/Fax: 61-3-93810595
Mobile: 0413247188
www.cain.net.au
+-------------------------------------------------+
------------------------------
Date: Thu, 21 Oct 1999 06:47:55 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Process Locking
Message-Id: <vGyP3.452$Vy1.8246@nsw.nnrp.telstra.net>
[Please, when you follow up, put your reply _after_ what you reply to.
Time does run forward on Usenet, and this is not Jeaopardy]
[Please do not quote signatures when replying. It's unnecessary]
[Fixed format]
On Thu, 21 Oct 1999 04:10:18 GMT, dean@contender.cain.net.au
<dean@contender.cain.net.au> wrote:
> Martien Verbruggen <mgjv@comdyn.com.au> wrote:
> > On Thu, 21 Oct 1999 03:39:55 GMT,
>
> > I would use Net::FTP and write a script, and only run it once.
>
> >> Should I be using the sysopen function to do this or is there
> >> an easier way?
>
> > Huh? This makes no sense to me at all... sysopen? for what?
> > Weren't you doing something with ftp?
>
> Yep, I am trying to achieve an ftp session. Now what I am also
> trying to achieve is to ensure that if this process starts, that
> all further attempts to run it fail until the first process is
> fully completed. The script will be called from cron.
>
> Thanks for the reply.
Oh, now I get it. The Subject says 'Process locking', even though the
post itself doesn't actually mention this. And you didn't mention
crontab at all.
Ok, what is often done in such a case is that the process starts up.
It tries to open a file in some known place (/var/run/blabla or
/var/lock/blabla or something like that). If it can successfully open
the file, it requests an exclusive lock. If it can get that, it dumps
its pid in there, and then proceeds.
pseudo code:
open file /var/run/my_name.pid
if failed bail out with error message
flock file exclusively
if failed
read pid from file
bail out with warning 'process pid already is running'
endif
continue with process
-- process ends
close file
optionally clean up file
There is no need for sysopen. Perl's open and flock will do the job
quite nicely.
The flock documentation has a good example:
# perldoc -f flock
Martien
--
Martien Verbruggen |
Interactive Media Division | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd. | from a rich salesperson.
NSW, Australia |
------------------------------
Date: 21 Oct 1999 02:54:47 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: subroutine
Message-Id: <7ulv9n$75a$2@rguxd.viasystems.com>
rancorr@hotmail.com wrote:
:>how do i get a subroutine to return a string? the result i get from
:>the subroutine is always a scalar.
Ummm. Is this a trick question?
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: Thu, 21 Oct 1999 05:22:48 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: subroutine
Message-Id: <s0t8p8ksr0133@corp.supernews.com>
lt lindley (ltl@rgsun40.viasystems.com) wrote:
: rancorr@hotmail.com wrote:
: :>how do i get a subroutine to return a string? the result i get from
: :>the subroutine is always a scalar.
:
: Ummm. Is this a trick question?
"Waiter! There are snails in my escargot!" - Inspector Clouseau
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Wed, 20 Oct 1999 22:49:41 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Substitution
Message-Id: <MPG.1278494d4f67f8898a0e5@nntp.hpl.hp.com>
In article <slrn80suan.dh0.pete@theory2.phys.cwru.edu> on 21 Oct 1999
02:24:23 GMT, Peter J. Kernan <pete@theory2.phys.cwru.edu> says...
> On Wed, 20 Oct 1999 16:21:35 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
...
> .= print <PLAN>;
> .=
> and the browser should DWIM? w/the <p>'s in this becomes
>
> print map {s/$/<p>/;$_} <PLAN>;
The browser doesn't have to DWIM anything, especially not the '<p>'s,
which would uglify the output irreparably.
Look back at the code you cut out from my post:
print "Content-Type: text/plain\n\n";
I can think of only one word to comment about this:
Gotcha!
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 21 Oct 1999 05:15:13 GMT
From: sushi38@my-deja.com
Subject: Re: Trim text
Message-Id: <7um7gq$ca7$1@nnrp1.deja.com>
Thanks to all for the help. I tried Govindaraj's small piece of code
and it worked off the bat. I am pasting below what I came up with, and
although I might be wrong, I fell there must be a more efficient way of
doing this. Thanks for any input.
#!/usr/bin/perl
#Turn off Perl buffering
$| = 1;
@junk = `finger joe@there.com`;
open (Equake, ">quake.txt") || die "Can't open quake.txt for writing! $!
\n";
if (@junk eq ""){print "No results from finger"}
else {print Equake @junk};
close (Equake);
open(INPUT, "<quake.txt") || die "Can't open quake.txt for reading! $!
\n";
while ( <INPUT> )
{
if ( $_ =~ m/^--/ )
{
$LastLine = $PrevLine;
}
$PrevLine = $_;
}
close(INPUT);
open (Lastquake, ">lastquake.txt") || die "Can't open quake.txt for
writing! $!\n";
if ($LastLine ne "") {print Lastquake $LastLine}
else {print Lastquake "Nothing"};
close (Lastquake);
print "Location: http://www.myserver.com/cgi-bin/quake.txt\n\n";
exit;
Thanks again,
Eddie.
In article <s0qso1o1r0138@corp.supernews.com>,
Govindaraj <umungo01@shafika.vetri.com> wrote:
> Hi,
>
> Here is my small piece of code:
>
> #!/usr/local/bin/perl
>
> my $input = './input.txt';
> open(INPUT,"<$input") || die "Can't open '$input'! $!\n";
>
> while ( <INPUT> )
> {
> if ( $_ =~ m/^--/ )
> {
> $LastLine = $PrevLine;
> }
> $PrevLine = $_;
> }
> close(INPUT);
> print $LastLine;
>
> Try this piece.
>
> Govindaraj M.
>
> sushi38 wrote:
> >
> >
> > I do not have much experience with perl, but from what I have seem
this
> > must be pretty easy to accomplish. In a text file, I would like to
trim
> > n characters that come before a certain string. For example:
> >
> > 99/10/19 19:38:06 33.11N 116.51W 13.3 2.2MGN C* 6 mi. ENE of
> > 99/10/19 19:50:44 34.62N 116.25W 6.0 2.8MGN C* 34 mi. N of
Joshua
> > 99/10/19 20:11:43 34.88N 116.15W 0.5 3.6ML C* 27 mi. S of
Baker
> > ----------------------------------------------
> > <> Last update was on 19-OCT-1999 20:15 gmt
> >
> > I would like to extract last line before the "----------------------
----
> > --------------------". Since all lines come in a fixed width, it
does
> > not sound like a complicated task.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 20 Oct 1999 21:09:40 -0700
From: tgy@chocobo.org (Neko)
Subject: Re: Unix code to perl
Message-Id: <s48OOKVpNn4urt8Ztwl6NA9asOoH@4ax.com>
On Thu, 21 Oct 1999 01:43:21 GMT, Vincent Murphy
<vincent.murphy@cybertrust.gte.com> wrote:
>>>>>> "Abdoulaye" == Abdoulaye Fofana <abdoulaye.fofana@compaq.com> writes:
>
> >> Is there a way to rewite this Perl/UNIX code strictly in perl.
> Abdoulaye> Thanks in advance
>
> Abdoulaye> @all_file = ("file1", "file2", "file3", "file4" );foreach ( 'egrep -l
> Abdoulaye> '$pattern' @all_file` )
> Abdoulaye> {
> Abdoulaye> print "$_\n";
> Abdoulaye> }
>
>perl -nle '$/="";if (/pattern/) { print $ARGV; next}' *.pl
That will print $ARGV once for each line that matches instead of once for
each file. You need to wrap '$/=""' inside a BEGIN {} or move it to a
command line switch:
perl -ln0777e 'print $ARGV if /pattern/' *.pm
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: 21 Oct 1999 02:53:21 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: Wall Street E-Commerce
Message-Id: <7ulv71$75a$1@rguxd.viasystems.com>
Larry Rosler <lr@hpl.hp.com> wrote:
:>In article <7ulo2a$23l$1@nnrp1.deja.com> on Thu, 21 Oct 1999 00:51:27
:>GMT, TODD MURRAY <kipbrak@my-deja.com> says...
:>> I need to speak with the Guru's who are ready to accept this challenge
:> ^
:>You don't know the difference between plurals and possessives.
Hold on there Larry. If the guy is for real and he is talking over
$200K/year, some of us might be willing to move (or commute) to N.Y.,
even if he is ignorant about writing proper English. :-)
But he is probably just another pimp who can't actually deliver the
money.
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: Thu, 21 Oct 1999 03:40:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Wall Street E-Commerce
Message-Id: <QWvP3.353$Vy1.5925@nsw.nnrp.telstra.net>
On Thu, 21 Oct 1999 00:51:27 GMT,
TODD MURRAY <kipbrak@my-deja.com> wrote:
> We have all heard the rumours of the largest most prestigious Wall
> Street Brokerage Houses pursuing on-line trading. Well the time has
> arrived!!
Nope, we haven't. And don't shout.
> I am working with the largest Wall Street Brokerage House and Investment
Is that the one on the corner? That really really large one?
> Bank in staffing their projects, with the BEST JAVA, and Web Development
BEST JAVA? BEST JAVA? Contradiction. And too loud.
> Talent in the country. Money is not the issue, it is the talent that
Not the issue? Please, send me a check of $200,000 US and I'll think
about it.
> Wall Street is short of. The difficulty is that there is a huge
Well, we all knew that.
> shortage of e-commerce talent in the Financial Sector here in New York
> City.
Nono.. There's a lot of e-commerce (read new-wave marketing) talent
around there. Just no one who has the technical knowledge to put any
substance behind all the hype.
> Please help me!!!!
Don't shout. Especially not that loud.
> I need to speak with the Guru's who are ready to accept this challenge
The bit 'with the Guru is who are' does not work very well,
grammatically.
> both technically and financially. If you are not interested please
> refer to those who are.
I have no problem accepting large amounts of dosh. I do have a problem
dealing with people who are all hype and no substance, and who have no
clue about Usenet etiquette, but still use it to get their spam out
there.
If you want to hire someone, and you have lots of money, use a decent
headhunting company.
But I suspect that 'money is not the issue' actually means 'We have no
money. We hope to get some, by parasitising off your work. You will
most likely never see a cent of it'.
> I am sincerely sorry to those who are not interested, but this is the
> only way I can get to you who are. Thanks for your understanding.
You should be sincerely sorry that you posted this here in the first
place. You owe us an apology. Come on, be the first spammer to
publicly apologise for posting a crappy job ad to this newsgroup.
But you are not actually reading this, are you?
> TODD MURRAY
> TECHNICAL RECRUITER
> (212) 971-0958
Oooh, you must be important. Your name is all in capitals.
> --
> TODD MURRAY
> TECHNICAL RECRUITER
> (212) 971-0958
Twice.
Gosh. I _am_ impressed.
Now. Go away. Do not come back until you are ready to post a
grovelling apology. Shoo.
Martien
--
Martien Verbruggen |
Interactive Media Division | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd. | bundled with your Microsoft product.
NSW, Australia |
------------------------------
Date: Thu, 21 Oct 1999 05:20:34 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Wall Street E-Commerce
Message-Id: <s0t8l2uvr017@corp.supernews.com>
TODD MURRAY (kipbrak@my-deja.com) wrote:
: We have all heard the rumours of the largest most prestigious Wall
: Street Brokerage Houses pursuing on-line trading. Well the time has
: arrived!!
That's odd, I was under the impression that the time had arrived several
years ago. In fact, I was just reading on ZDNet about Schwab going
offline for two hours earlier today and raising legions of day-traders'
blood pressures. :)
: I am working with the largest Wall Street Brokerage House and Investment
: Bank in staffing their projects, with the BEST JAVA,
Working with the best java is always a sound plan. Costa Rican Tres Rios
is ideal if you can get it.
: and Web Development
: Talent in the country. Money is not the issue, it is the talent that
: Wall Street is short of. The difficulty is that there is a huge
: shortage of e-commerce talent in the Financial Sector here in New York
: City.
Was your original language German, by any chance?
: Please help me!!!!
: I need to speak with the Guru's
The guru's what? His cat? His left sandal?
: who are ready to accept this challenge
: both technically and financially. If you are not interested please
: refer to those who are.
Those who are presumbaly hang out in a group with 'java' in its name
somewhere, rather than 'perl'.
: I am sincerely sorry to those who are not interested, but this is the
: only way I can get to you who are. Thanks for your understanding.
No it isn't, and I don't. 'misc.jobs.offered'? One of the job sites?
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: 21 Oct 1999 10:31:34 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Wall Street E-Commerce
Message-Id: <380edd76_1@newsread3.dircon.co.uk>
lt lindley <ltl@rgsun40.viasystems.com> wrote:
> Larry Rosler <lr@hpl.hp.com> wrote:
> :>In article <7ulo2a$23l$1@nnrp1.deja.com> on Thu, 21 Oct 1999 00:51:27
> :>GMT, TODD MURRAY <kipbrak@my-deja.com> says...
>
> :>> I need to speak with the Guru's who are ready to accept this challenge
> :> ^
> :>You don't know the difference between plurals and possessives.
>
> Hold on there Larry. If the guy is for real and he is talking over
> $200K/year, some of us might be willing to move (or commute) to N.Y.,
> even if he is ignorant about writing proper English. :-)
>
> But he is probably just another pimp who can't actually deliver the
> money.
>
I would say that is the case - that is certainly what I would infer from :
>> I need to speak with the Guru's who are ready to accept this challenge
>> both technically *and financially*.
(My emphasis)
/J\
--
"While we've been on the air we've had reports that Prince Charles has
eaten beef on the bone" - Justin Webb, BBC One O'Clock News
------------------------------
Date: Thu, 21 Oct 1999 10:53:11 +0200
From: Yann Duplaix <yduplaix@netscape.com>
Subject: Win32 install problem
Message-Id: <380ED477.90AD818A@netscape.com>
Hi,
I have just tried to install the last version of ActivePerl (v 521).
All was fine, but it seems that one file is missing: <perl.dll>, which is quite
important!
An another install did the same (with the same version or on older one).
Does anyone have any feedback on this perl distribution?
Thanks in advance.
Yann
------------------------------
Date: Thu, 21 Oct 1999 11:40:42 +0200
From: Yann Duplaix <yduplaix@netscape.com>
Subject: Win32 install problem
Message-Id: <380EDF9A.CAB61A39@netscape.com>
Hi,
I have just tried to install the last version of ActivePerl (v 521) on
NT 4.
All was fine, but it seems that one file is missing: <perl.dll>, which
is quite
important!
An another install did the same (with the same version or on older one).
Does anyone have any feedback on this perl distribution?
Thanks in advance.
Yann
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 1138
**************************************