[7709] in Perl-Users-Digest
Perl-Users Digest, Issue: 1335 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 18 01:07:40 1997
Date: Mon, 17 Nov 97 22:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 17 Nov 1997 Volume: 8 Number: 1335
Today's topics:
Re: +>> (Martien Verbruggen)
adding to the end of each element in an array (Steve)
Re: Can't make DOS box under Win95 "see" .pl extensions <etta@none.com>
Re: CGI Script Output....help. (Martien Verbruggen)
Re: Connecting to Oracle (John D Groenveld)
control characters <smantri@gmu.edu>
Re: control characters (Gerry Buzzell)
Re: control characters (brian d foy)
DB_File within Safe cpt ? (Bob Goldstein)
Re: eval and scoping problem <lucs@cam.org>
Re: function parameters (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
help: debugging perl scripts... <tjbiuso@redrose.net>
How to: GD-1.14, Perl 5.004.01 & OS/2? samdie@ibm.net
Last element of an anonymous array (Norman Gaywood)
LWP SSL status <chris@ixlabs.com>
Multihomedness and Socket::inet_aton() <philipp@delete-this.enteka.com>
NCSA Error (devesh)
Re: Perl and B+ tree implementation (Jeremy D. Zawodny)
perl conversion of curly quotes out of web form (Bruce Wyman)
Re: question on DB_File module (and tie) <zenin@best.com>
Re: Removing text regex? (Eric Bohlman)
Re: split problems (Terry Michael Fletcher - PCD ~)
Re: stripping Unix carraige returns (dave)
system vs. backtics. What difference? <w.stanton@auckland.ac.nz>
Re: system vs. backtics. What difference? <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Re: system("...") on Perl 5 on OS/2 (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Upgrading from Active State to Current Build versio <etta@none.com>
What's the difference between AnyDBM_File and GDBM_File <vidals@etica-entertainment.com>
Re: Win95, Perl, and Personal Web Server (Doran Barons)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Nov 1997 01:47:11 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: +>>
Message-Id: <64qs2v$bnb$7@comdyn.comdyn.com.au>
In article <3471a94d.21983381@news.ais.net>,
syarbrou@ais.net (Steve) writes:
> Is +>> (read/append) a valid command in perl for opening a file? I
> thought perl only allowed reading or writing of a file but not both?
> If valid, does it have any problems associated with it? I'm having
> some problems with file contents clearing at different times when
> running my program and thought this may be involved. Thanks.
The documentation:
perldoc -f open
[snip]
If the filename begins with '>>', the file is opened for
appending. You can put a '+' in front of the '>' or '<' to indicate that
you want both read and write access to the file; thus '+<' is almost
always preferred for read/write updates--the '+>' mode would clobber the
file first. The prefix and the filename may be separated with spaces.
These various prefixes correspond to the fopen(3) modes of 'r', 'r+', 'w',
'w+', 'a', and 'a+'.
[snip]
Sounds like perl does allow reading and writing.
HTH
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
NSW, Australia |
------------------------------
Date: Tue, 18 Nov 1997 05:44:24 GMT
From: syarbrou@ais.net (Steve)
Subject: adding to the end of each element in an array
Message-Id: <3471ec64.39161497@news.ais.net>
I have searched far and wide and can not find the answer to this.
I know chomp can take a character or group of characters off each
element in an array. Is there something that can do the opposite? In
otherwords if I have an array, and want to add \n to the end of each
element, is there a single command like chomp to do this? I know a
simple foreach would do it, but what's the point. This is
perl(shorter the better).
Steve
------------------------------
Date: 18 Nov 1997 02:28:07 GMT
From: "etta" <etta@none.com>
Subject: Re: Can't make DOS box under Win95 "see" .pl extensions...
Message-Id: <64qufn$kis@mtinsc04.worldnet.att.net>
Is perl set up in your autoexe.bat file? Just a thought!
etta
Edward W. Morris, Jr. <emorr@fast.net> wrote in article
<01bcf3c2$8ffda120$0891f5ce@emorris>...
> Hey. I've installed Perl build 5.003_07 for Win32 on my Win95 box. I
can
> double click on a .pl script and it runs, but I can't run one from the
Dos
> box. He says Unknown command, so I know he's not reading .pl extension
> like he would .BAT or .EXE. What gives? I know my registry is correct.
I
> checked under Classes for .pl, which has Perl in it, and Perl has the
> proper registry keys. they're the same as NT, which DOESN'T have this
> problem. Thanks in advance!!!
> --
> email: emorr AT fast.net
> web: http://www.users.fast.net/~emorr
>
------------------------------
Date: 18 Nov 1997 01:42:45 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: CGI Script Output....help.
Message-Id: <64qrql$bnb$6@comdyn.comdyn.com.au>
In article <346F7325.5CC43DC0@nbnet.nb.ca>,
Michael Butler <mgb@nbnet.nb.ca> writes:
> #!/usr/bin/perl
>
> print "Content-type: text/html/n/n";
The problem lies in the above line. It's \n, not /n
(the odd thing is that you did it right in the later code)
I suggest that you use CGI.pm to take care of this sort of stuff anyway.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use being
NSW, Australia | a damn fool about it.
------------------------------
Date: 17 Nov 1997 23:19:02 -0500
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Connecting to Oracle
Message-Id: <64r4vm$8ni$1@tholian.cse.psu.edu>
In article <64pc1m$4cd@sjx-ixn2.ix.netcom.com>,
Michael A. Chase <mchase@ix.netcom.com> wrote:
>You can find the latest DBD-Oracle at
>http://www.perl.com/CPAN/modules/authors/Tim_Bunce/DBD/. I just
>finished installing DBI and DBD-Oracle this weekend and it is working
>fine so far. Be sure to read the README files thoroughly before you
>build and install the module.
I think he's short a compiler, in which case he needs to join the dbi-users
mailling list and ask for a binary. The mailling list is described in the
README.
John
groenvel@cse.psu.edu
------------------------------
Date: Mon, 17 Nov 1997 21:54:00 -0500
From: shiva mantri <smantri@gmu.edu>
Subject: control characters
Message-Id: <Pine.OSF.3.95q.971117214552.25328A-100000@osf1.gmu.edu>
hi
Can anyone tell me how to remove any control character??????????
i tried
$line =~ s/\c.//g #to remove any control character
$line =~ s/\c[a-z]//g #Both dont work..............
tried
$line =~ s/\cm//g #did remove control-m. good
but i want to remove any control character..
Shiva Mantri
---
7032738119,7039938736
------------------------------
Date: Tue, 18 Nov 1997 04:26:15 GMT
From: gbuzzell@hardlink.com (Gerry Buzzell)
Subject: Re: control characters
Message-Id: <34711894.949507977@news.ne.mediaone.net>
gbuzzell@hardlink.com[Gerry Buzzell] wrote:
>hi
>
>Can anyone tell me how to remove any control character??????????
>
>i tried
> $line =~ s/\c.//g #to remove any control character
> $line =~ s/\c[a-z]//g #Both dont work..............
>
>tried
> $line =~ s/\cm//g #did remove control-m. good
>
>but i want to remove any control character..
>
>Shiva Mantri
>---
>7032738119,7039938736
>
How about $line =~ s/[\cA-\cZ]//g;
------------------------------
Date: Mon, 17 Nov 1997 23:42:55 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: control characters
Message-Id: <comdog-ya02408000R1711972342550001@news.panix.com>
In article <Pine.OSF.3.95q.971117214552.25328A-100000@osf1.gmu.edu>, smantri@gmu.edu wrote:
>Can anyone tell me how to remove any control character??????????
how about just using their octal values?
tr/\000-\037//;
of course, you might want to think about that a bit before doing it ;)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 18 Nov 1997 02:37:25 GMT
From: bobg@uic.edu (Bob Goldstein)
Subject: DB_File within Safe cpt ?
Message-Id: <64qv15$1ag8$1@piglet.cc.uic.edu>
Please, will some wizard tell me how to use dbm files
(perferably Berkeley DB) inside a Safe.pm compartment?
I think I'm close:
use Safe;
use DB_File;
$cpt=new Safe;
$cpt->share_from('DB_File::HASHINFO', [qw(&TIEHASH &STORE &FETCH)] );
$cpt->rdo("myprogram");
and in "myprogram" :
use Fcntl;
tie %hash, "main", "dbfile", O_CREAT|O_RDWR;
$hash{mykey} = "stuff";
This does seem to share the routines from DB_File into cpt,
although for some reason the tie statement wants "main"
instead of "DB_File", probably because of how the share_from
sub mangles the packages/name spaces.
Nonetheless, the subs do get called. But the "dbfile"
never gets created, and the assignment $hash{mykey}="stuff";
dies in the STORE routine because somehow "mykey" is not
valid or unrecognized. Hmmm.
It's ok to tell me this is not secure, and I'd be curious to
know why. But in my case, I only need mild security to
prevent people from accidently shooting their feet. If they
really like foot bullets, I don't need to stop them here.
Many thanks to anyone who can unravel Safe.pm for me.
I realize there are problems, generally, in using modules
inside a compartment. But in this case, I'm willin to go
the extra distance in sharing the relevant routines.
If I only knew how :-(
If convenient, please copy bobg@uic.edu. TIA.
bobg
------------------------------
Date: Mon, 17 Nov 1997 23:57:45 -0500
From: Luc St-Louis <lucs@cam.org>
Subject: Re: eval and scoping problem
Message-Id: <34712049.5BA15C4A@cam.org>
Zenin wrote:
> [snip-snip]
> Your entire package gets eval()ed when you "use" it, including
> the inline 'eval "\$pkg::A2 = 2";' code, which in turn defines
> ...
> Since the eval of $pkg::B2 doesn't happen until your run Foo, you're
> only "using it once" at compile time.
I see.
> And on a similar note,
> stop using full package paths to point to variables in your current
> package, you're working too hard:
>
> package pkg;
> use strict;
> use vars qw($A1 $A2 $B1 $B2);
> $A2 = 2;
>
> #!/usr/local/bin/perl -w
> use strict;
> use pkg;
> print "$pkg::A2\n";
Actually, the example I gave is a bit abstract (as you may have guessed
:-). In reality, my package won't know until runtime which variables it
will be declaring. But I managed to get it working by using something
like
sub Foo { ... eval "\$pkg::$Var = \'$Val\'"; ... }
int the pkg.pm file, and
BEGIN { 'pkg'->Foo(); }
in the main file.
Thanks for your help.
Luc
------------------------------
Date: Mon, 17 Nov 97 21:27:16 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: function parameters
Message-Id: <3470fd22$1$ofn$mr2ice@speaker>
In <EJt3wE.CzG@world.std.com>, on 11/17/97 at 08:07 PM,
aml@world.std.com (Andrew M. Langmead) said:
+-----
| Its just without the assignment you end up having to deal with the
| identifier-that-looks-like-line-noise "$_[0]".
+--->8
...the question arises: how does that differ from the rest of Perl? ;-}
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
"Never piss off a bard, for they are not at all subtle and your name scans to
`Greensleeves'." ---unknown, quoted by Janet D. Miles in alt.callahans
------------------------------
Date: Mon, 17 Nov 1997 19:11:06 -0500
From: MrPc <tjbiuso@redrose.net>
Subject: help: debugging perl scripts...
Message-Id: <3470DD19.4D995BDA@redrose.net>
i am sort of a newbie to perl. i have winnt 4.0 and redhat linux on my
machine. i prefer to use windows. are there any debuggers out there
for me?
------------------------------
Date: Mon, 17 Nov 97 20:58:22 -0500
From: samdie@ibm.net
Subject: How to: GD-1.14, Perl 5.004.01 & OS/2?
Message-Id: <3470f7e3$1$fnzqvr$mr2ice@news-s01.ny.us.ibm.net>
Has anyone managed to install GD under os/2?
The following shows some of the problems that I'm running into:
epm: L:\perl5\cpan >untgz gd-1_14_tar.gz
epm: L:\perl5\cpan >cd gd-1.14
epm: L:\perl5\cpan\gd-1.14 >perl makefile.pl
Checking if your kit is complete...
Looks good
MakeMaker (v5.4002)
Potential libraries are '-lsocket -lm -lbsd':
socket not found in j:/emx.add/lib
'-lsocket' found at j:/emx/lib/socket.lib
m not found in j:/emx.add/lib
'-lm' found at j:/emx/lib/m.lib
bsd not found in j:/emx.add/lib
'-lbsd' found at j:/emx/lib/bsd.lib
Writing Makefile for libgd
Warning: I could not locate your pod2man program. Please make sure,
your pod2man program is in your PATH before you execute 'make'
Writing Makefile for GD
epm: L:\perl5\cpan\gd-1.14 >make
mkdir ./blib
mkdir ./blib/lib
mkdir ./blib/arch
mkdir ./blib/arch/auto
mkdir ./blib/arch/auto/GD
mkdir ./blib/lib/auto
mkdir ./blib/lib/auto/GD
mkdir ./blib/man3
cp GD.pm ./blib/lib/GD.pm
AutoSplitting GD (./blib/lib/auto/GD)
cp qd.pl ./blib/lib/qd.pl
DEFINE=''; export DEFINE INC; \
cd libgd && make -e
make[1]: Entering directory `/perl5/cpan/gd-1.14/libgd'
gcc -c -Zomf -Zmt -Il:/perllib/lib/os2/5.00401/CORE gdfontg.c
gcc -c -Zomf -Zmt -Il:/perllib/lib/os2/5.00401/CORE gdfontmb.c
gcc -c -Zomf -Zmt -Il:/perllib/lib/os2/5.00401/CORE gdfontt.c
gcc -c -Zomf -Zmt -Il:/perllib/lib/os2/5.00401/CORE mtables.c
gcc -c -Zomf -Zmt -Il:/perllib/lib/os2/5.00401/CORE gdfontl.c
gcc -c -Zomf -Zmt -Il:/perllib/lib/os2/5.00401/CORE gdfonts.c
gcc -c -Zomf -Zmt -Il:/perllib/lib/os2/5.00401/CORE libgd.c
emxomfar cr libgd.lib gdfontg.obj gdfontmb.obj gdfontt.obj mtables.obj \
gdfontl.obj gdfonts.obj libgd.obj
emxomfar: Symbol multiply defined: cost
make[1]: *** [libgd.lib] Error 2
make[1]: Leaving directory `/perl5/cpan/gd-1.14/libgd'
make: *** [libgd/libgd.lib] Error 2
# edit makefile to remove mtables.obj as componenet of libgd.obj
# mtables.c was "#included" by libgd.c - hope one copy is enough
epm: L:\perl5\cpan\gd-1.14 >make
DEFINE=''; export DEFINE INC; \
cd libgd && make -e
make[1]: Entering directory `/perl5/cpan/gd-1.14/libgd'
gcc -c -Zomf -Zmt -Il:/perllib/lib/os2/5.00401/CORE libgd.c
emxomfar cr libgd.lib gdfontg.obj gdfontmb.obj gdfontt.obj \
gdfontl.obj gdfonts.obj libgd.obj
make[1]: Leaving directory `/perl5/cpan/gd-1.14/libgd'
make[1]: Entering directory `/perl5/cpan/gd-1.14/libgd'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/perl5/cpan/gd-1.14/libgd'
j:/emx/bin/perl -Il:/perllib/lib/os2/5.00401 -Il:/perllib/lib
l:/perllib/lib/ExtUtils/xsubpp \
-typemap l:/perllib/lib/ExtUtils/typemap \
-typemap typemap GD.xs >GD.tc && mv GD.tc GD.c
Process terminated by SIGSEGV
core dumped
SYS1808:
The process has stopped. The software diagnostic
code (exception code) is 0005.
epm: L:\perl5\cpan\gd-1.14 >
--
-----------------------------------------------------------
samdie@ibm.net 199711170858 -0500
------------------------------
Date: 18 Nov 1997 16:26:46 +1100
From: norm@turing.une.edu.au (Norman Gaywood)
Subject: Last element of an anonymous array
Message-Id: <64r8um$jod@turing.une.edu.au>
How do I find the last element of an anonymous array in the following
context. At least, I think I'm asking that question!
I have created an array that contains some references to other arrays:
while (<>){
$data[ i++ ] = [ split ];
}
Then I do something like this, to generate an HTML table with CGI.pm:
print table( {-border=>1},
map { TR( $_ ) } map { td( $_ ) } @data
);
That seems to work OK. But, suppose I don't want the first element of
each line. I want to do an array slice and write the map part as:
map { TR( $_ ) } (map { td( $_ ) } @data)[1..$#??]
But what goes where the ?? is?
I know, I can be a bit more verbose and write out some big loops and aviod
these map functions. But where's the fun in that? :-)
--
Norman Gaywood -- School of Mathematical and Computer Sciences
University of New England, Armidale, NSW 2351, Australia
norm@turing.une.edu.au http://turing.une.edu.au/~norm
Phone: +61 2 6773 2412 Fax: +61 2 6773 3312
------------------------------
Date: Mon, 17 Nov 1997 19:14:23 -0800
From: Chris Schoenfeld <chris@ixlabs.com>
Subject: LWP SSL status
Message-Id: <3471080F.7C7F@ixlabs.com>
I am in dire need of a way to write a Perl HTTP user agent that can
handle SSL requests.
I am tinkering with the LWP/SSLeay/lwpssl combo, but it seems it
provides nothing more than a socket connection (i.e. no HTTP requests as
in normal LWP). I have no desire to write a mini-https client that can
handle POST requests.
Does anyone know of any other way I could do this?
Are there any ways I could manipulate another Linux SSL-capable browser
(i.e Netscpae, Lynx(SSL?)) from Perl?
Any help would be greatly appreciated.
Chris Schoenfeld
------------------------------
Date: Mon, 17 Nov 1997 18:12:55 -0800
From: "Philip A. Prindeville" <philipp@delete-this.enteka.com>
Subject: Multihomedness and Socket::inet_aton()
Message-Id: <3470F9A7.4A51@delete-this.enteka.com>
I was just wondering why the inet_aton() call doesn't return an
array of 4 byte packed strings instead of a single value, when a
host is multihomed. We are using perl scripts to monitor some
routers here, and when we can't connect to one address we would
like to be able to connect to others... (since the interface
corresponding to the first address we try might be down).
Since a typical usage is:
$x = inet_ntoa(...)
returning an array should not break things, as the first element in
the list will go into $x, as before.
I'm using Net::Telnet 3.00 and I would be willing to make the
necessary mods to support multihomedness.
Please include me in any replies (philipp@enteka.com).
Thanks,
-Philip
------------------------------
Date: 18 Nov 1997 04:06:59 GMT
From: devesh@numbat.cs.rmit.EDU.AU (devesh)
Subject: NCSA Error
Message-Id: <64r493$cet$1@goanna.cs.rmit.edu.au>
Hi ,
I encountered the Error 500 on installing my software(developed using Apache1.
1.1) on m/c running NCSA 1.5.1. I managed to fix the problem by adding another
newline to the Content type header. When i installed the software on another se
rver also running NCSA , the same error persists. When i copied the configratio
n files to my machine and used those conf files to run NCSA on my m/c, the soft
ware runs fine. The gist of this is , In my opinion the problem is with server
configration. I found this line added in the access.conf file on the problem se
rver NCSA access.conf file
IncludesNOEXEC added for devesh
Is this the cause of trouble ??? Or any other suggestions???
Ur help is highly appreciated...
devesh
--
**********************************************
devesh Jain
13/150 alma rd.
------------------------------
Date: Tue, 18 Nov 1997 02:39:40 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Perl and B+ tree implementation
Message-Id: <3470ffc3.167738585@woody.wcnet.org>
[original author automagically cc'd via e-mail]
On Mon, 17 Nov 1997 20:34:02 -0500, Mark Lorenc
<malorenc@eden.rutgers.edu> wrote:
>I'm currently taking a class on databases at my university. In this
>class, it is required that I write an implementaion of a b+ tree in
>whatever language I choose. Obviously - I'd really like to write it in
>perl. I've used perl for sys admin cases, various scripts, and cgi
>stuff, however this is new and seems to have me stumped. What would be
>the best way to implement a tree node (manually) in perl? It would have
>to contain a few data fields, and an equal number of "pointers" that
>refer to other nodes. This would normally implemented with a structure
>in C, or a big hoochin list in lisp, etc, .... but ....
You probably need to read up on references in Perl 5. See the perlref
manpage for some useful ideas.
Jeremy
--
Jeremy D. Zawodny jzawodn@wcnet.org
Web Server Administrator www@wcnet.org
Wood County Free Net (Ohio) http://www.wcnet.org/
------------------------------
Date: Tue, 18 Nov 1997 00:51:31 -0500
From: bw@tiac.net (Bruce Wyman)
Subject: perl conversion of curly quotes out of web form
Message-Id: <bw-1811970051320001@usd.tiac.net>
Setting up a web form in which a random person will be pasting a bunch of
word document formatted text. The pasted material will contain right and
left double quotation marks (curly quotes) and the single flavors of the
same.
I'm using perl to rewrite the material into an html page and therefore
want to change the typographically correct stuff into " and ' marks.
How the hell do I do it?
The obvious, to me, is something like
$foobar=~s/[curly bits]/"/g;
but that doesn't cut it - there are no values for [curly bits].
What am I overlooking in my last few hours of net searching? I know that
according the the RFCs that the 8-bit ascii values I'm hunting for are
2018,2019,201c, and 201d but there's no way to have perl see those, yes?
Any advice is appreciated. It's perl. I'm sure I'm just overlooking the
painfully obvious.
------------+----------------------------------------------
Bruce Wyman | bwyman@neaq.org <http://www.neaq.org/>
bw@tiac.net | Webmaster, New England Aquarium
------------+---------------------------------------------+
"for whatever we lose (like a you or a me) |
it's always ourselves we find in the sea" -e.e. cummings |
------------------------------
Date: 18 Nov 1997 02:16:10 GMT
From: Zenin <zenin@best.com>
Subject: Re: question on DB_File module (and tie)
Message-Id: <879819526.747412@thrush.omix.com>
[ posted & mailed ]
robert <robert@il.fontys.nl> wrote:
: I'm using something similar to the following in one of my programs:
: $db = tie %hash, DB_File, "test", O_CREAT|O_TRUNC|O_RDWR, 0644;
: Now, I don't really need that $db for very long, just long enough to get
: the filedescriptor ($db->fd) so I can lock the database-file.
So don't ever define $db and call fd() off your tie() like this:
$fd = tie (
%hash, 'DB_File', 'test', O_CREAT|O_TRUNC|O_RDWR, 0644
)->fd
or die "tie(): $!";
# lock or something
But yes, undefing $db _should_ be ok, since the object is referenced
"magicly" by perl until untie() anyway. -This is how it knows what
package the variable is tied to.
--
-Zenin
zenin@best.com
------------------------------
Date: Tue, 18 Nov 1997 01:27:23 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Removing text regex?
Message-Id: <ebohlmanEJtIpn.MrE@netcom.com>
William L. Gorder (no@spam.please) wrote:
: I am a newbie at regular expressions (and a total Perl neophite) and I have
: been trying to come up with an understanding of how I would accomplish the
: following: I need to remove a section or sections of text from a file (well,
: OK, 2000+ files). The text in question looks something like this:
: LD ID = "L501"
: EB = "SS"
: LG = "STATEEST"
: WEXIST = 0.0
: VEXIST = 0.0
: LDXM MW = "N"
: MVAR = "N"
: VL ID = "EQX"
This looks like an application for the range operator:
print unless /^LD(XM)?\b/../^$/;
------------------------------
Date: 18 Nov 1997 03:47:08 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: split problems
Message-Id: <64r33s$8j0$1@news.fm.intel.com>
Wim Verhaegen (verhaege@esat.kuleuven.ac.be) so eloquently and verbosely pontificated:
>
> In the following, I always use the example
> m1 a b c d e foo=5 bar=6 foobar pi=3.1415
with this example, qw// will work:
($name, $a, $b, $c, $d, $e, @pars) = qw($string);
if you want to allow some whitespace around the "=", i suggest:
$string =~ s/\s+=\s+/=/g;
($name, $a, $b, $c, $d, $e, @pars) = qw($string);
of course, this wont *leave* whitespace around an assignment, even if it
was necessary.
hope that helps.
--
#!/usr/local/bin/perl -w
system("pod2html $0")&&die"Just another Perl hacker,\n";system("
lynx $0.html")&&die"Just another Perl hacker,\n";unlink"$0.html";
=head1 Just another POD hacker, tfletche@pcocd2.intel.com
------------------------------
Date: Tue, 18 Nov 1997 01:54:24 GMT
From: over@the.net (dave)
Subject: Re: stripping Unix carraige returns
Message-Id: <3470f47e.1785337@news.one.net>
"Mark Aurit" <mark_aurit@mail.northgrum.com> wrote:
>I have a web page that uses Perl to write the output of a form to a
>comma-seperated file, which I download into Excel
>(the file is created on a SGI Box running IRIX (Unix)).
>The problem is when people use carriage returns in
>Textarea boxes; Excel doesnt like them!
Check to make sure your FTP program is using ASCII mode transfers.
Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________
------------------------------
Date: 18 Nov 1997 16:14:15 +1200
From: Worik Macky Stanton <w.stanton@auckland.ac.nz>
Subject: system vs. backtics. What difference?
Message-Id: <wkk9e6on3c.fsf@auckland.ac.nz>
Friends
On Win95.
Given an executable foo\bar.exe
The script...
my $a = 'foo\bar.exe';
print `$a`;
Works well.
my $a = 'foo/bar.exe';
print `$a`;
Outputs "Bad command or file name" But...
my $a = 'foo/bar.exe';
system($a);
Works fine.
But I want to catch the stdout from foo/bar.exe.
I assume that the reason backtics do not work is that the shell barfs
on the '/' as a directory seperator, where system bypasses the shell.
So...
Can I get the STDOUT from a system(...) call?
Worik
------------------------------
Date: Mon, 17 Nov 1997 21:26:05 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: system vs. backtics. What difference?
Message-Id: <64r8t7$i0k@bgtnsc02.worldnet.att.net>
Is there a particular reason you have to use that forward slash? If so (like
if you have to run the same script under both Windows and Unix), why not
my $a="foo/bar.exe";
$a =~ s/\//\\/g;
$p = `$a`;
print $p;
If not, I'd just use the backslashes and be done with it. Many times it's
much easier to work your way around a problem than to work your way through
it. :D
-- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl
Worik Macky Stanton wrote in message ...
>Friends
>
>On Win95.
>
>Given an executable foo\bar.exe
>
>The script...
>
>my $a = 'foo\bar.exe';
>print `$a`;
>
>Works well.
>
>my $a = 'foo/bar.exe';
>print `$a`;
>
>Outputs "Bad command or file name" But...
>
>my $a = 'foo/bar.exe';
>system($a);
>
>Works fine.
>
>But I want to catch the stdout from foo/bar.exe.
>
>I assume that the reason backtics do not work is that the shell barfs
>on the '/' as a directory seperator, where system bypasses the shell.
>
>So...
>
>Can I get the STDOUT from a system(...) call?
>
>Worik
------------------------------
Date: Mon, 17 Nov 97 23:54:54 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: system("...") on Perl 5 on OS/2
Message-Id: <347120f4$1$ofn$mr2ice@speaker>
In <3470A91C.2F87@caibm.ibm.com>, on 11/17/97 at 03:29 PM,
Larry Menard <lmenard@caibm.ibm.com> said:
+-----
| In my testing of Perl 5 on OS/2, I've found that system("...") no longer
| works: system("cmd /c ...") must be used.
| We didn't have to do this on Perl 4. Why is it now necessary in Perl 5?
+--->8
Consistency. system() attempts to run the command directly, unless it
contains metacharacters --- in which case it uses sh.exe (choose one: pdksh,
bash, etc.) This is transparent unless you're calling CMD.EXE builtins, which
you probably shouldn't, as there are better ways to do them. (In particular,
if you were doing system("COPY ..."), have a look at the File::Copy module,
which portably does file copies in the optimum way for each OS.)
--
brandon s. allbery [Team OS/2][Linux][JAPH] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
"Never piss off a bard, for they are not at all subtle and your name scans to
`Greensleeves'." ---unknown, quoted by Janet D. Miles in alt.callahans
------------------------------
Date: 18 Nov 1997 02:25:38 GMT
From: "etta" <etta@none.com>
Subject: Re: Upgrading from Active State to Current Build versions
Message-Id: <64qub2$kis@mtinsc04.worldnet.att.net>
There should be a uninstall in the perl bin dir, just click it and then
delete the folder.
etta
Jeremy D. Zawodny <jzawodn@wcnet.org> wrote in article
<3475e613.161162088@woody.wcnet.org>...
> [original author automagically cc'd via e-mail]
>
> On Mon, 17 Nov 1997 21:19:09 GMT, rbj@NOSPAMix.netcom.com (Doran)
> wrote:
>
> >I'm currently using Active State's build 3.13 on my NT and Win95
> >machines, but would just as soon use one of the current builds of
> >Perl. What is the best way to uninstall the old one and install the
> >new?
------------------------------
Date: Mon, 17 Nov 1997 21:53:49 -0800
From: Gil Vidals <vidals@etica-entertainment.com>
Subject: What's the difference between AnyDBM_File and GDBM_File???
Message-Id: <34712D6D.1CA3E638@etica-entertainment.com>
I've written the following two test programs in Perl 5.004 and need help
understanding the results. I'm new to databases, so bare with me. I'd
like to create a GDBM file that I'll eventually use for User
Authentication while running Apache 1.2.4 on a Linux box 2.0.3.
When I run PROGRAM A, the result is the creation of TWO DB files:
1) /tmp/GDBM_any.dir
2) /tmp/GDBM_any.pag
When I run PROGRAM B, the results is the creation of ONE DB file:
1) /tmp/GDBM_any
I thought the two programs should give me the same output. Please
explain what is going on here.
Thanks,
Gil
************** PROGRAM A ********************
#!/usr/bin/perl -w
use AnyDBM_File;
@AnyDBM_file::ISA = qw(GDBM_File);
use Fcntl; # for O_* values
$password_file1 = "/tmp/GDBM_any";
tie (%passwords, "AnyDBM_File", $password_file1, O_RDWR|O_CREAT, 0644)
or die "cannot open dbm $password_file1";
$passwords{"gil"} = "gil";
$passwords{"terri"} = "terri";
while (($key, $value) = each(%passwords)) {
print "$key has value of $value\n";
}
untie %passwords;
************** PROGRAM B ********************
#!/usr/bin/perl -w
use Fcntl; # for O_* values
use GDBM_File;
$password_file1 = "/tmp/GDBM_any";
tie (%passwords, "GDBM_File", $password_file1, O_RDWR|O_CREAT, 0644)
or die "cannot open dbm $password_file1";
$passwords{"gil"} = "vidals";
$passwords{"terri"} = "terri";
while (($key, $value) = each(%passwords)) {
print "$key has value of $value\n";
}
untie %passwords;
------------------------------
Date: Tue, 18 Nov 1997 05:25:21 GMT
From: doran@mail.brandx.net (Doran Barons)
Subject: Re: Win95, Perl, and Personal Web Server
Message-Id: <3471259d.3492056@nntp.ix.netcom.com>
rbj@NOSPAMix.netcom.com (Doran) wrote:
>I think I might know what the problem is, but I'm hoping for some
>confirmation. In my registry, I have set the Script Map in
>LOCAL_MACHINE/SYSTEM/CURRENTCONTROLSET/SERVICES/W3SRV/PARAMETERS
>to execute the following for .pl and .cgi extentions:
>c:\perl\bin\perl.exe %1 %*
>
>I did this because I read it in two places online last night. But this
>morning when I came to work and checked the NT machine I noticed that
>it's line had %s instead of %1 and %*. So the NT registry reads:
>c:\perl\bin\perl.exe %s %s
>
>Could this be the cause of the problem (executing the first script in
>the directory), having %1 %* instead of %s %s?
Well, I tried it and it seems to work. It needs to be %s %s and _not_
%1 %*, though I still don't know why (and is probably off-topic here).
I'm still looking for more documentation too. Maybe I'll spend a day
and put up the little I've gathered together. But not tonight.
Take care all,
db
------------------------------
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 1335
**************************************