[9012] in Perl-Users-Digest
Perl-Users Digest, Issue: 2630 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 18 16:07:55 1998
Date: Mon, 18 May 98 13:00:36 -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 Mon, 18 May 1998 Volume: 8 Number: 2630
Today's topics:
Re: 500 Server Error: .../somescript.pl contained no bl <doug@weboneinc.net>
? Sorting a hash in Perl based on the contents of a lis <fp@pmpcs.com>
Re: ? Sorting a hash in Perl based on the contents of a (Jeffrey R. Drumm)
Any PERL FTP module for Windows? nowen@acm.org
Re: Any PERL FTP module for Windows? (Jeffrey R. Drumm)
Authentication?? <Mark_Sage@Compuserve.com>
Re: Does Perl have a IDE?I don't like command line. (Abigail)
Re: Does Perl have a IDE?I don't like command line. (Leslie Mikesell)
Re: Does Perl have a IDE?I don't like command line. (Leslie Mikesell)
Re: Does Perl have a IDE?I don't like command line. <angst@scrye.com>
Re: Does Perl have a IDE?I don't like command line. <jsd@gamespot.com>
Re: Does Perl have a IDE?I don't like command line. (Michael J Gebis)
Re: ftpd <ahdiii@webspan.net>
Function syntax with prototyping, filehandles and array (Marc Haber)
Re: How do I get STDOUT back? (Stuart McDow)
Re: How do I get STDOUT back? (Craig Berry)
Re: How to retrieve the NTFS file owner (WIN32) <Jan@McCann.cz>
Re: I need to determine WHOLE numbers. HELP? <merlyn@stonehenge.com>
Re: Is if ($a="something") a bad style? <merlyn@stonehenge.com>
Re: LWP vs Perl/Tk/Sockets for database interface. (Bryan Miller)
May SPUG Meeting in Bellevue (Seattle PERL Users Group)
Re: Perl & OLE\COM Inproc Servers (Jan Dubois)
Re: regexp: replacing new line followed by "+" (Craig Berry)
Re: regexp: replacing new line followed by "+" (Craig Berry)
Re: Relative Newbie Question: Multiple Form Inputs Into <angst@scrye.com>
Re: Scanning Perl scripts for Y2K problems (Abigail)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 18 May 1998 15:05:59 -0400
From: Douglas Clifton <doug@weboneinc.net>
Subject: Re: 500 Server Error: .../somescript.pl contained no blank line separating header and data
Message-Id: <35608697.B4BF551E@weboneinc.net>
Tom Phoenix wrote:
>
> On 18 May 1998, J|rgen P|nter wrote:
>
> > Or perhaps it read:
> >
> > print "Content-type: text/html";
> > <-- notice empty line
> > print ...;
> >
> > and you 'tweaked' ;-) this into:
> >
> > print "Content-type: text/html";
> > print ...;
> >
> > which does not work.
>
> What makes you think that Perl cares about an empty line like that?
Perhaps he was thinking of a `here' document:
print <<HTML;
Content-type: text/html
<html>
<body>
...
</body>
</html>
HTML
--
Douglas Clifton
Unix/C/Perl/CGI/HTML Programmer
doug@weboneinc.com
------------------------------
Date: Mon, 18 May 1998 14:12:07 -0400
From: "Peter Perchansky" <fp@pmpcs.com>
Subject: ? Sorting a hash in Perl based on the contents of a list ?
Message-Id: <6jptn3$ska$1@usenet45.supernews.com>
Greetings:
If I have one hash of data (field name / key, value) in unsorted order, and
I have a list (field names) is there a way for me to sort the hash by the
list while retaining the appropriate key & value pairs?
Example unsorted hash
%record = ("Age" => "35-39", "ID" => 1, "Date_Option" => "No");
Example list
@order = ("ID", "Age", "Date_Option");
What I want to end up with:
%record = ("ID" => 1, "Age" => "35-39", "Date_Option" => "No");
Please note the intent is to avoid hard coding as the field names may
change.
If it is convenient for you, please email me a copy of your response.
Thank you for your time.
--
===========================================================
Peter Perchansky, Computer Consultant & Microsoft FrontPage MVP
Dynamic Net, Inc. DBA PMP Computer Solutions
Providing Dynamic Databases, Design, & Electronic Commerce Solutions
FrontPage Web Hosting at http://www.pmpcs.com/services/fpwebhosting.htm
FrontPage Support http://www.msfrontpage.net/
------------------------------
Date: Mon, 18 May 1998 19:34:53 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: ? Sorting a hash in Perl based on the contents of a list ?
Message-Id: <35618a41.31008187@news.mmc.org>
[posted and mailed]
On Mon, 18 May 1998 14:12:07 -0400, "Peter Perchansky" <fp@pmpcs.com> wrote:
>Greetings:
Howdy.
>If I have one hash of data (field name / key, value) in unsorted order, and
>I have a list (field names) is there a way for me to sort the hash by the
>list while retaining the appropriate key & value pairs?
>Example unsorted hash
> %record = ("Age" => "35-39", "ID" => 1, "Date_Option" => "No");
>Example list
> @order = ("ID", "Age", "Date_Option");
>What I want to end up with:
> %record = ("ID" => 1, "Age" => "35-39", "Date_Option" => "No");
>Please note the intent is to avoid hard coding as the field names may
>change.
You can't "store" a hash in any order that makes sense to humans other than
Larry Wall, but you sure can iterate over it in whatever order you provide the
keys. If the @order array contains the keys in the desired order, it's as
simple as:
foreach $field_name (@order) {
do_something_with $record{$field_name};
}
If this doesn't answer your question, then I guess I don't know what you're
asking . . . :-)
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Mon, 18 May 1998 18:40:27 GMT
From: nowen@acm.org
Subject: Any PERL FTP module for Windows?
Message-Id: <6jpvar$sl9$1@nnrp1.dejanews.com>
Dear everybody,
Could anyone tell me if there's any FTP module (like Net-FTP) that is able to
run on Windows? If so, where I can obtain this module?
Thank you.
Noel Owen
nowen@acm.org
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 18 May 1998 19:37:39 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Any PERL FTP module for Windows?
Message-Id: <35628d74.31826834@news.mmc.org>
[posted and mailed]
On Mon, 18 May 1998 18:40:27 GMT, nowen@acm.org wrote:
>Dear everybody,
>
>Could anyone tell me if there's any FTP module (like Net-FTP) that is able to
>run on Windows? If so, where I can obtain this module?
>
>Thank you.
>
>Noel Owen
>nowen@acm.org
The Sarathy port (aka "The Standard Win32 Distribution") includes Net::FTP.
However, upgrading libnet to 1.0605 is recommended. You can find the port at:
http://www.perl.com/CPAN-local/ports/win32/Standard/x86/perl5.00402-bindist04-bc.zip
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Mon, 18 May 1998 20:24:54 +0100
From: Mark Sage <Mark_Sage@Compuserve.com>
Subject: Authentication??
Message-Id: <35608B06.6C6C474D@Compuserve.com>
I am trying to get a PERL program to display a user/password dialog, and
then process the input. I can make the dialog display by sending a
"HTTP/1.0 404 Not Authorized", but no matter what I do I cannot get
anything returned.
Is this possible, can I do it with PERL, does anyone have an example?
If this is not the way to authenticate, is there another way, I am
trying to avoid using standard text/password HTML fields or using the
web servers own authentication.
Cheers
Mark.
------------------------------
Date: 18 May 1998 18:11:33 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jptkl$7bt$2@client3.news.psi.net>
Jon Drukman (jsd@gamespot.com) wrote on MDCCXXI September MCMXCIII in
<URL: news:356071AE.E0DE0E9D@gamespot.com>:
++ Abigail wrote:
++ > ++ > Well, one of the largest Unix vendors (if not the largest) Sun
++ > ++ > doesn't deliver a compiler with its OS either. If you want one, you
++ > ++ > have to pay.
++ > ++ Do you pay for gcc?
++ >
++ > gcc is hardly native to SunOS, is it? Besides, how do you build gcc
++ > without a compiler?
++
++ there are prebuilt packages you can download. your original statement:
++ "if you want one [c compiler], you have to pay" is false.
That is ``[native c compiler]''. And that's still true.
Abigail
--
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-
------------------------------
Date: 18 May 1998 13:36:35 -0500
From: les@MCS.COM (Leslie Mikesell)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jpv3j$qfn$1@Mars.mcs.net>
In article <6jpivg$4gb$1@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>Stuart McDow (smcdow@arlut.utexas.edu) wrote on MDCCXX September MCMXCIII
>in <URL: news:6jn636$f9i$1@ns1.arlut.utexas.edu>:
>++ abigail@fnx.com (Abigail) writes:
>++
>++ > I'm sorry, Linux is a nice OS, but many things that are available
>++ > for NT or commercial Unices aren't available for Linux. There's no
>++ > Sybase for Linux, or Oracle, or X-runner, or a lot of other
>++ > (commercial) packages.
>++
>++ And commercial packages are important why?
>
>The packages itself are important. Not the fact that they are
>commercial. Do you have a non-commercial alternative for a
>thing like Oracle or Sybase? X-runner? Neuron Data?
>The company I work for would be very interested, as it doesn't
>like to pay the sometimes expensive licenses.
Postgresql is a nice free nearly-complete (lacks HAVING and a
few other things) SQL database: http://www.postgresql.org. It
is actively supported and has a recently updated ODBC driver
that allows access from MS-windows.
Les Mikesell
les@mcs.com
------------------------------
Date: 18 May 1998 13:41:27 -0500
From: les@MCS.COM (Leslie Mikesell)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jpvcn$qio$1@Mars.mcs.net>
In article <6jpl2i$29p$1@ns1.arlut.utexas.edu>,
Stuart McDow <smcdow@arlut.utexas.edu> wrote:
>abigail@fnx.com (Abigail) writes:
>>
>> The company I work for would be very interested, as it doesn't like
>> to pay the sometimes expensive licenses.
>
>I wonder what the long-term cost difference is between paying for
>expensive software and rolling your own (or paying someone to roll it
>for you).
This is entirely unpredictable as free software may be well supported
(or correct in the first place) and the company selling the commercial
package may disappear the day after you buy it. Once upon a time
I thought buying unix from AT&T was a safe bet...
Les Mikesell
les@mcs.com
------------------------------
Date: 18 May 1998 19:18:11 GMT
From: angst <angst@scrye.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jq1hj$e61$1@jelerak.scrye.com>
Abigail <abigail@fnx.com> wrote:
: ++ >
: ++ > gcc is hardly native to SunOS, is it? Besides, how do you build gcc
: ++ > without a compiler?
: ++
: ++ there are prebuilt packages you can download. your original statement:
: ++ "if you want one [c compiler], you have to pay" is false.
: That is ``[native c compiler]''. And that's still true.
Whether the OS ships with a compiler is irrelevant when you can download
a prebuilt package at popular ftp archives (sunsite) for free, and have it
on the system within the space of half an hour. After you have the prebuilt
gcc, of course, downloading the latest version of the src and compiling
it with your brand new prebuilt one would be a good idea.
You have to pay for _Sun's_ c compiler...you can get a better c compiler
than sun's (gcc) for free very easily.
These days, the only thing the OS really needs to ship with is the kernel
and ftp...everything else you can get from any number of good archive
sites (most notably GNU mirrors).
--
Erik Nielsen <eln@rmci.net>
mail to above (rather than header address) is answered significantly faster.
this post != views of anyone at all, really
"You are like...unix GOD" -- local tech support
------------------------------
Date: Mon, 18 May 1998 12:19:52 -0700
From: Jon Drukman <jsd@gamespot.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <356089D8.994B7F09@gamespot.com>
Abigail wrote:
> ++ there are prebuilt packages you can download. your original statement:
> ++ "if you want one [c compiler], you have to pay" is false.
>
> That is ``[native c compiler]''. And that's still true.
why is the distinction between c compiler and native c compiler useful
or important? in what way will downloading gcc limit you on solaris vs
what you would be able to do if you bought SUNpro?
--
Jon Drukman jsd@gamespot.com
-----------------------------------------------------------------------
Plan: Eat right, exercise regularly, die anyway.
------------------------------
Date: 18 May 1998 19:41:53 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jq2u1$h2r@mozo.cc.purdue.edu>
Jon Drukman <jsd@gamespot.com> writes:
}Abigail wrote:
}> ++ there are prebuilt packages you can download. your original statement:
}> ++ "if you want one [c compiler], you have to pay" is false.
}>
}> That is ``[native c compiler]''. And that's still true.
}why is the distinction between c compiler and native c compiler useful
}or important? in what way will downloading gcc limit you on solaris vs
The question then is: Why are people calling NT a "closed" system, and
Solaris an "open" system?
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Mon, 18 May 1998 15:08:40 -0400
From: Arthur Dardia <ahdiii@webspan.net>
Subject: Re: ftpd
Message-Id: <35608738.5819CB28@webspan.net>
I believe there's a file called "ftp.pl" (or maybe just "ftp") that
shipped with the Win32 port by ActiveState. It's in Perl\lib. HTH.
Arthur Dardia
Walter Fitzharris wrote:
> I am looking for an ftp daemon written in perl(5).
>
> So far, I can only find linux versions in c and yacc.
>
> Anyone?
------------------------------
Date: Mon, 18 May 1998 19:18:31 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Function syntax with prototyping, filehandles and arrays
Message-Id: <6jq1ia$n5b$5@nz12.rz.uni-karlsruhe.de>
Hi!
I am trying to write a function that does some processing on an
already opened filehandle that should be passed in from the caller
(and that _might_ actually be STDIN) and - as a side effect - filling
an array with information pulled from the file.
The array really is a side effect so I am reluctant to let the
function return the array in question - that would take away the focus
from the important processing to the "unimportant" array buildup.
One of my various prototypes is
sub write_to_temp(*$$$*)
{
my (*FH,$mailfilename,$heloname,$sender,@rcpts) = @_;
# do it
return 0;
}
that should be called like
my @array;
my $filename="/tmp/myfile";
my $host="localhost";
my $sender="me@do.main";
write_to_temp(\STDIN,$filename,$host,$sender,@rcpts);
In the future, it might be necessary to return a second array, so I'd
like to cater for that. It makes no sense to build a trap I might step
into a few months from now.
I might have to admit that I never understood when to use $, @ or %
when accessing arrays, hashes and scalar values. I have actually read
the Camel book and have found that it is quite sparse with examples
and hard to read for a non-native speaker.
Could anyone please enlighten me or point me to really useful
examples?
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: 18 May 1998 18:17:23 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: How do I get STDOUT back?
Message-Id: <6jptvj$2kv$1@ns1.arlut.utexas.edu>
The answer's right there in your posting. Enclose the section of code
for which STDOUT is to be localized in braces.
{
local *STDOUT; # override STDOUT for this routine only
open (STDOUT, '/dev/null');
&subroutine; # call the subroutine whose output needs to be supressed.
close (STDOUT);
}
--
Stuart McDow Applied Research Laboratories
smcdow@arlut.utexas.edu The University of Texas at Austin
"Look for beauty in roughness, unpolishedness"
------------------------------
Date: 18 May 1998 18:41:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How do I get STDOUT back?
Message-Id: <6jpvci$otu$4@marina.cinenet.net>
Mark666769 (mark666769@aol.com) wrote:
[massive snip]
: My question is, how can I do the same thing - get rid of the redefinition of
: STDOUT - myself, without using a subroutine to do it?
Just put the region where you localize *STDOUT into a block {}. It's the
subroutine block, not the "subroutine-ness" itself, that's limiting the
locality scope.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Mon, 18 May 1998 21:23:30 -0700
From: Jan Krynicky <Jan@McCann.cz>
Subject: Re: How to retrieve the NTFS file owner (WIN32)
Message-Id: <35610942.223E@McCann.cz>
Marcus Breitenstein wrote:
>
> Hello !
>
> Is it possible to retrieve the WIN32 NTFS File owner ?
>
> Help appreciated,
> Marcus
Don't have my WinNT's by hand, but Win32::FileSecurity should
do it.
If you use the AS port it's already there.
If you use the GS port you should go to
http://www.perl.com/CPAN/authors/Gurusamy_Sarathy
to get the newest libwin32.
(Though the version already in the binary distribution should do.)
HTH, Jenda
------------------------------
Date: Mon, 18 May 1998 18:55:54 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
To: cberry@cinenet.net (Craig Berry)
Subject: Re: I need to determine WHOLE numbers. HELP?
Message-Id: <8cyavzz9vp.fsf@gadget.cscaper.com>
>>>>> "Craig" == Craig Berry <cberry@cinenet.net> writes:
Craig> $divByThreeFlag = ! $var % 3;
"You keep using that [operator]. I do not think that means
what you think it means." -- Princess Bride (2nd ed. :-)
Precedence problem there. Either use "not", or add parens:
$divBlah = !($var % 3);
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 105 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 18 May 1998 18:52:21 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Is if ($a="something") a bad style?
Message-Id: <8c1ztr1kez.fsf@gadget.cscaper.com>
>>>>> "John" == John Moreno <phenix@interpath.com> writes:
John> Mark-Jason Dominus <mjd@op.net> wrote:
>> if ((n = xpchk(z, i+k)) == 0) {
>> ...
>> }
John> A easy way to make stuff like that clear, write it like this:
John> if (0==(n = xpchk(z, i+k))) {
John> ...
John> }
John> Do your comparisons with a constant first - then if you make a mistake
John> the compiler will flag it for you.
Oddly enough, you just reversed the sense of the test. I don't know
if you did that intentionally, but that shows the *flaw* of this
method -- it's too easy to get backwards.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 105 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 18 May 1998 18:02:01 GMT
From: millerb@millerb.fc.hp.com (Bryan Miller)
Subject: Re: LWP vs Perl/Tk/Sockets for database interface.
Message-Id: <6jpt2p$olk@fcnews.fc.hp.com>
Greg Bacon (gbacon@cs.uah.edu) wrote:
: In article <6ji9ul$fsv@fcnews.fc.hp.com>,
: millerb@millerb.fc.hp.com (Bryan Miller) writes:
: : I am interested in input from Perl hackers as two which is
: : simpler/cleaner: using LWP and POSTing to a CGI script or
: : simply writing a small Perl/Tk form that submits/retrieves
: : data directly to/from the SQL database?
: You haven't given us specifics from your requirements. Are you
: interested in being able to talk to this database from the web?
No. All access will be from HPs intranet and right now I am
restricting access (via Apache) to our local subnet. One benefit
of using a browser is that I can use cookies to make authentication
a little easier on the user. This is not a high security database
but I would like to provide some user verification.
Bryan
------------------------------
Date: 18 May 1998 17:52:20 GMT
From: spug@halcyon.com (Seattle PERL Users Group)
Subject: May SPUG Meeting in Bellevue
Message-Id: <6jpsgk$3pu$1@brokaw.wa.com>
SPUG, the Seattle Perl Users Group, will meet on May 19th (3rd Tuesday)
from 7-9pm, at CIBER, 2125 112th Ave. NE, Suite 201, Bellevue WA 98004.
Andrew Sweger of UW's Dept. of Family Medicine and Douglas Beaver
of Amazon.com will speak on "Perl Built-In Functions" (sort, grep,
map, etc.)
Admission is free, and open to the general public.
For more information, see http://www.halcyon.com/spug/, or send Email
to spug@halcyon.com.
===============================================================
| Tim Maher, Ph.D. Tel/Fax: (206)781-UNIX |
| SPUG Founder & Leader Email: spug@halcyon.com |
| Seattle Perl Users Group HTTP: www.halcyon.com/spug |
===============================================================
------------------------------
Date: Mon, 18 May 1998 21:13:47 +0200
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Perl & OLE\COM Inproc Servers
Message-Id: <35608558.4353600@news2.ibm.net>
[mailed & posted]
"Regi John" <rejohn@ix.netcom.com> wrote:
>The Win32 doc for OLE Automation states that Perl works only with .exes, not
>..dlls (inproc servers)? Is this indeed the case, or is there a fix out there
>somewhere?
This is not true. In-proc servers work perfectly well with Win32::OLE
from libwin32-0.12. Earlier versions would start a local server in
preference to the in-proc server if both were available.
-Jan
------------------------------
Date: 18 May 1998 18:08:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: regexp: replacing new line followed by "+"
Message-Id: <6jptej$otu$1@marina.cinenet.net>
Lemaitre, Laurent (r29173@email.sps.mot.com) wrote:
: In a text file I want to replace a newline by a space
: only when the newline is followed by a +.
:
: For example:
: =======================
: My first line My first line + end of my
: first line
: + end of my first line -->
: =======================
:
: I tried different options (/s,/m/ and so on) but all failed.
Take the time to learn what those mean; it's a little tricky, but it's
well worth your while to do so.
To solve your particular problem, first note that you must have the entire
text of the file in a single long string (e.g., by reading it in with $/
undefined). Then, this substitution should do the trick:
$text =~ s/\n\+/ /g;
Note that /s and /m are irrelevant, as they only effect the metacharacters
., ^, and $, which do not appear in this regex.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 18 May 1998 18:10:56 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: regexp: replacing new line followed by "+"
Message-Id: <6jptjg$otu$2@marina.cinenet.net>
Craig Berry (cberry@cinenet.net) wrote:
: To solve your particular problem, first note that you must have the entire
: text of the file in a single long string (e.g., by reading it in with $/
: undefined). Then, this substitution should do the trick:
:
: $text =~ s/\n\+/ /g;
:
: Note that /s and /m are irrelevant, as they only effect the metacharacters
: ., ^, and $, which do not appear in this regex.
I didn't notice initially that you wanted to keep the '+'. Use
$text =~ s/\n\+/ +/g;
instead.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 18 May 1998 19:25:53 GMT
From: angst <angst@scrye.com>
Subject: Re: Relative Newbie Question: Multiple Form Inputs Into a List Array
Message-Id: <6jq201$e61$2@jelerak.scrye.com>
Tom Phoenix <rootbeer@teleport.com> wrote:
: (You probably mean "array", not "list array" - there's no such thing as a
: "list array"! :-) CGI.pm explains this in its docs. Hope this helps!
Unless it's an array of lists, or a list of arrays, or a list of lists,
or an array of arrays, or whatever. But I doubt that's what he meant.
--
Erik Nielsen <eln@rmci.net>
mail to above (rather than header address) is answered significantly faster.
this post != views of anyone at all, really
"You are like...unix GOD" -- local tech support
------------------------------
Date: 18 May 1998 18:09:28 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Scanning Perl scripts for Y2K problems
Message-Id: <6jptgo$7bt$1@client3.news.psi.net>
Bart Lateur (bart.mediamind@tornado.be) wrote on MDCCXX September
MCMXCIII in <URL: news:355fd1f5.3292698@news.tornado.be>:
++
++ OTOH, I don't think anybody should start counting seconds since the
++ beginning of Christian time, as different countries have corrected their
++ calendar at different moments in time. But all before 1970. And even
++ before 1900.
No, the latter statement is not true. Russia converted this century.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'
------------------------------
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 2630
**************************************