[13650] in Perl-Users-Digest
Perl-Users Digest, Issue: 1060 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 15 14:26:45 1999
Date: Fri, 15 Oct 1999 11:26:26 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940011985-v9-i1060@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 15 Oct 1999 Volume: 9 Number: 1060
Today's topics:
Re: Forcing Javascript to be on when a user uses a Perl <kperrier@blkbox.com>
Re: Forcing Javascript to be on when a user uses a Perl <cassell@mail.cor.epa.gov>
Re: Forcing Javascript to be on when a user uses a Perl <gellyfish@gellyfish.com>
Form button problems. sduggan7643@my-deja.com
Re: Form button problems. <flavell@mail.cern.ch>
forms-based HTML editing? (was: We're Looking For Web G <rp@win.tue.nl>
FTP Perl Module??? ldh7@my-deja.com
Re: FTP Perl Module??? (Brett W. McCoy)
Re: FTP Perl Module??? <bwalton@rochester.rr.com>
Re: FTP Perl Module??? (Martien Verbruggen)
FTP: The fastest most efficient way to do this? <ralawrence@my-deja.com>
Re: FTP: The fastest most efficient way to do this? (Bill Moseley)
Gathering info from multi-line text logfile <hawkwynd@my-deja.com>
GDBM write in CGI PERL <l.laperrousaz@net-clic.net>
Re: GDBM write in CGI PERL <rootbeer@redcat.com>
Re: GDBM write in CGI PERL <cassell@mail.cor.epa.gov>
Gettin Path except last dir krun@my-deja.com
Re: Gettin Path except last dir <azielke@hotmail.com>
Re: Getting Win Perl working with MS Personal Web Serve <aryumin@copris.com>
Ha ha! emlyn_a@my-deja.com
Re: Hash size limit ? (longish) <qumsieh@sympatico.ca>
Re: Hash size limit ? (longish) (Ilya Zakharevich)
Re: Help - Perl regular expression question! <dvoon@my-deja.com>
HELP --> Save output in a variable <marco.cerqui@alcatel.ch>
Re: HELP --> Save output in a variable <abarb@nmg.fr>
Re: HELP --> Save output in a variable (Brett W. McCoy)
Re: HELP --> Save output in a variable <jtribbeck@argogroup.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Oct 1999 21:53:53 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: Forcing Javascript to be on when a user uses a Perl script
Message-Id: <32BE7BCF6AE77C6E.1864A35BEB1B71DB.9C106328B604140D@lp.airnews.net>
"Lauren Smith" <laurensmith@sprynet.com> writes:
>
> I think you'd be better off asking for Javascript code in a Javascript
> newsgroup like comp.lang.javascript
>
Are you kidding ?!!?? Don't you knwo that all of the experts in everything
Internet hang out here in c.l.p.m? You can ask your Java,C,sh,tcl,python,
smalltalk,http,server configuration,linux install,.....,hardware problems
here and your will get a prompt and courteous reply.
:)
Kent
--
They were killing machines. I wanted to be them so bad.
-- Jamie Zawinski
http://www.jwz.org/gruntle/grave.html
------------------------------
Date: Wed, 13 Oct 1999 14:47:26 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Forcing Javascript to be on when a user uses a Perl script
Message-Id: <3804FDEE.282CD719@mail.cor.epa.gov>
Kent Perrier wrote:
>
> "Lauren Smith" <laurensmith@sprynet.com> writes:
> >
> > I think you'd be better off asking for Javascript code in a Javascript
> > newsgroup like comp.lang.javascript
>
> Are you kidding ?!!?? Don't you knwo that all of the experts in everything
> Internet hang out here in c.l.p.m? You can ask your Java,C,sh,tcl,python,
> smalltalk,http,server configuration,linux install,.....,hardware problems
> here and your will get a prompt and courteous reply.
Hey Kent, don't limit yourself to hardware and software. Remember
cooking too. Tom Christiansen has posted recipes here, and Abigail
has thoughtfully supplied a recipe for cookies. :-)
And travel advice. Plenty of people here have told others where
to go, and how to get there.
And physical fitness. Although most of the advice of things for
people to do sounded way too hard to attempt. Those flying leaps,
for instance...
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 14 Oct 1999 09:30:54 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Forcing Javascript to be on when a user uses a Perl script
Message-Id: <380594be_2@newsread3.dircon.co.uk>
David Cassell <cassell@mail.cor.epa.gov> wrote:
> Kent Perrier wrote:
>>
>> "Lauren Smith" <laurensmith@sprynet.com> writes:
>> >
>> > I think you'd be better off asking for Javascript code in a Javascript
>> > newsgroup like comp.lang.javascript
>>
>> Are you kidding ?!!?? Don't you knwo that all of the experts in everything
>> Internet hang out here in c.l.p.m? You can ask your Java,C,sh,tcl,python,
>> smalltalk,http,server configuration,linux install,.....,hardware problems
>> here and your will get a prompt and courteous reply.
>
> Hey Kent, don't limit yourself to hardware and software. Remember
> cooking too. Tom Christiansen has posted recipes here, and Abigail
> has thoughtfully supplied a recipe for cookies. :-)
>
> And travel advice. Plenty of people here have told others where
> to go, and how to get there.
>
> And physical fitness. Although most of the advice of things for
> people to do sounded way too hard to attempt. Those flying leaps,
> for instance...
>
And the occasional spot of genealogical guidance ...
/J\
--
"You look lovely this evening. Have you decreased in mass?" - Alien,
The Simpsons
------------------------------
Date: Fri, 15 Oct 1999 12:46:16 GMT
From: sduggan7643@my-deja.com
Subject: Form button problems.
Message-Id: <7u77mk$epf$1@nnrp1.deja.com>
I am designing a form that uses the button tag instead of the input tag
to format the submit buttons. I'm doing it this way to use the text
formatting capabilities of the button tag.
My problem comes when I submit the form to the handling script. The
script doesn't see any button created with the button tag. When I use
the input tag to create submit buttons and name them in exactly the
same fashion as those created with the button tag the script sees them
just fine. Does anybody have any idea what I'm doing wrong?
This syntax doesn't work:
<button type='submit' name='btnSubmit' value='Submit'>Test Button
</button>
This syntax does work:
<input type='submit' name='btnSubmit' value='Submit'>
I try and grab the information as follows:
$button = $cgi->param('btnSubmit');
For the button tag the param function returns undef. I'm not sure why
it doesn't work.
Thanks in advance,
Scott
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 15 Oct 1999 18:08:09 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Form button problems.
Message-Id: <Pine.HPP.3.95a.991015180325.17527A-100000@hpplus01.cern.ch>
On Fri, 15 Oct 1999 sduggan7643@my-deja.com wrote:
> I am designing a form that uses the button tag instead of the input tag
> to format the submit buttons.
And your Perl language question is...?
> I'm doing it this way to use the text
> formatting capabilities of the button tag.
Most browser/versions don't have any support for <BUTTON>. In the few
that try to support it, it's mostly broken. The only one I found so far
that supports it as documented is Lynx, where there is little point in
using it anyway.
> My problem comes when I submit the form to the handling script. The
> script doesn't see any button created with the button tag.
Yup. my thoughts entirely.
> This syntax doesn't work:
> <button type='submit' name='btnSubmit' value='Submit'>Test Button
> </button>
And asking HTML questions in a Perl language group also "doesn't work".
------------------------------
Date: 14 Oct 1999 12:53:28 +0200
From: Reinier Post <rp@win.tue.nl>
Subject: forms-based HTML editing? (was: We're Looking For Web Gurus.)
Message-Id: <7u4cn8$9fi@cursus02.win.tue.nl>
jawolf@mediaone.net (James A. Wolf) wrote:
[...]
> As a Guru you'll get your bio on the site as well as a place
>to promote yourself, website, book, Etc.
"But now, with a pin-up guru every week,"
( http://www.inria.fr/koala/beust/genesis/selling.england.by.the.pound.html )
Incidentally, I have a question to Web gurus, too.
Freshmeat and casual looks in Web engines didn't give me a ready answer.
Working with Apache and Perl on a Unix platform, I am looking for a
simple server-side HTML editing system. Authors would be allowed to
edit their pages directly by browsing them in 'edit mode' and directly
changing the contents and structure using HTML forms. This would
simplify the editing process. It only works well for pages with
trivial HTML constructs. I'm thinking of the everything.blockstackers.com
system with elementary knowledge of HTML constructs added. PHP3 or
mod_perl could be used to implement it. My question is if someone
has done this already.
The intended application is a tree of documentation pages. They are
updated more often than they are read; usually, while working on some job
we discover a problem or a mistake and we need to make a quick change in
the documentation; we don't want to think about HTML and URLs at that time.
HTML 2.0 is more than enough the structure we need; simple HTML is in fact
a requirement, because it leaves the option open to use a text editor.
A forms-based, completely browser independent way of editing, that takes
care of the HTML and the URLs seems to be a good approach.
Can anybody suggest an existing system with this capability?
--
Reinier Post reinpost@win.tue.nl
[Some newsgroups omitted]
[Followups set to comp.infosystems.www.authoring.site-design]
------------------------------
Date: Fri, 15 Oct 1999 02:00:12 GMT
From: ldh7@my-deja.com
Subject: FTP Perl Module???
Message-Id: <7u61r6$l0v$1@nnrp1.deja.com>
I need help finding the FTP perl module. Can anyone suggest how do
find it?
I also need help starting a procedure running FTP on a Windows server
using perl. Has anyone had a similar experience that they would like
to share? Or any advice or direction on how to handle it?
Any help would be appreciated.
Thank you,
Laura
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 15 Oct 1999 02:18:31 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: FTP Perl Module???
Message-Id: <slrn80d3vo.3jt.bmccoy@moebius.foiservices.com>
Also Sprach ldh7@my-deja.com <ldh7@my-deja.com>:
>I need help finding the FTP perl module. Can anyone suggest how do
>find it?
Start up the cpan shell (perl -MCPAN -e shell (altough the letst perl will
start up just with 'cpan'). Then enter 'i /FTP/ and it will list all of
the modules available. Actually, if you use cpan for the first time, it
will install the FTP module anyway (Net::FTP) as part of the
configuration.
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Thu, 14 Oct 1999 22:35:33 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: FTP Perl Module???
Message-Id: <380692F5.FD72253@rochester.rr.com>
ldh7@my-deja.com wrote:
>
> I need help finding the FTP perl module. Can anyone suggest how do
> find it?
You probably mean the LWP module, as there doesn't appear to be
a module called "FTP". Find it on CPAN, www.cpan.org
>
> I also need help starting a procedure running FTP on a Windows server
> using perl. Has anyone had a similar experience that they would like
> to share? Or any advice or direction on how to handle it?
It is unclear exactly what you want. Do you want to run an FTP
server on your Windoz system? In that case, you're probably best
off to get an FTP server program, like maybe wftpd (shareware,
www.wftpd.com -- works well for me). If you want a client, Windoz
comes with one of those, called "ftp". If you want an FTP server
written in Perl, well, maybe there is one somewhere... Or maybe
you mean that you want to run the Windoz ftp client from Perl?
If so, just use LWP instead.
...
> Laura
...
--
Bob Walton
------------------------------
Date: Fri, 15 Oct 1999 03:17:51 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: FTP Perl Module???
Message-Id: <z1xN3.301$Kd.4681@nsw.nnrp.telstra.net>
On Thu, 14 Oct 1999 22:35:33 -0400,
Bob Walton <bwalton@rochester.rr.com> wrote:
> ldh7@my-deja.com wrote:
> >
> > I need help finding the FTP perl module. Can anyone suggest how do
> > find it?
>
> You probably mean the LWP module, as there doesn't appear to be
> a module called "FTP". Find it on CPAN, www.cpan.org
What makes you think that? I can't find anything in the original post
that even hints at that.
I think they probably want the Net::FTP module. And in another
response someone already explained how to get it.
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | Hi, Dave here, what's the root password?
NSW, Australia |
------------------------------
Date: Fri, 15 Oct 1999 10:23:37 GMT
From: Richard Lawrence <ralawrence@my-deja.com>
Subject: FTP: The fastest most efficient way to do this?
Message-Id: <7u6vb1$96n$1@nnrp1.deja.com>
Hi I wonder if any of you perl gurus can help me out on this one :o)
I need to write a little function that takes in a username, password,
address and port number and return either 0 (no ftp service / no such
server / bad username or password), 1 (good password, able to log in)
or 2 (too many users).
Since this function will be called I need it to be as _efficient_ as
possible and this is where I am stuck. I don't need to FTP anything, I
just need to attempt to connect and log in and report on the status. So
do I use the FTP module or just try to open a connection to that port
and send some text reading off the reply? (bearing in mind that the ftp
server may be running on a different port).
I currently have a simple function that tries to connect to the port
and returns 1 or 0 and I need to improve on that.
What would people recommend?
Rich
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 15 Oct 1999 06:58:47 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: FTP: The fastest most efficient way to do this?
Message-Id: <MPG.1270d2f6b713586598980b@nntp1.ba.best.com>
Richard Lawrence (ralawrence@my-deja.com) seems to say...
> I need to write a little function that takes in a username, password,
> address and port number and return either 0 (no ftp service / no such
> server / bad username or password), 1 (good password, able to log in)
> or 2 (too many users).
>
> Since this function will be called I need it to be as _efficient_ as
> possible and this is where I am stuck.
That's a good start. I find making functions that I _don't_ call
_efficient_ doesn't really seem to help much.
> I don't need to FTP anything, I
> just need to attempt to connect and log in and report on the status.
perldoc LWP::UserAgent is what I do.
Net::FTP is also a good place to look
> What would people recommend?
Use modules. They are typically written by people that know what they
are doing.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Tue, 12 Oct 1999 22:38:21 GMT
From: Hawkwynd <hawkwynd@my-deja.com>
Subject: Gathering info from multi-line text logfile
Message-Id: <7u0d8s$hbu$1@nnrp1.deja.com>
My problem lies in getting the data into variables that can be counted,
and produce a report from the data.
Here's a sample of the data, which is a simple text (ascii) format file
from the program which generates it:
1500,QUANTUM
7813322 100699
60-029656 MANCHESTER EQUIPMENT COMPAN
JF00 JF00 1104
8 TOM ADAMS
5000,ADIC
7814549 100699
30-151270 SUNNYTECH
DD00 DD00 1236
8 JOHN
12000,SEAGATE
7816169 100699 TS035
10-796130 MICHADA COMPUTERS
DD00 DD00 1437
8 DAVID
The first line of the 'block' of data is a dollar amount and the vendor
name followed by 4 lines of other information.
I need to be able to have the script 'read' the data in each 'block' in
groups of 5 lines at a time, and assign each member of that block to
it's appropriate variable for counting, or tracking, like $money
(block1)...$money(block255)
Each block, represents 1 instance of a call record, so when I say
block, I mean record. Within each record, are fields that make up the
record:
dollars,vendor
callnumber date
account-no company
op-id1 op-id2 calltime
calltype customer-name
The dollars field is always numeric, vendor is always a string
callnumber is always numeric as xx-xxxxxx
company is always a string
opid1/opid2 is always a 4 character string
calltime is always 4 digit numeric
calltype is always 1 digit numeric
customer name is always a string, sometimes first and last name
Currently, I'm using this to read in the entire file to an array, and I
think this is what is correct:
(open (INF, "$file"))||die("Can't open $file"); # open the file for
reading
print "\n Opening $file for reading.. \n";
# read in all the data as a stream, assign it to an array
@ary = <INF>;
close(INF);
Now that the string is in the @ary, I need to be able to chop it into
usable variables, that will be used to produce the report. I don't have
the knowledge, and the FAQ is not providing me the information I need.
Psuedocode:
Open file
read all the data to an array
for each 5 lines of text {
get dollar value on line 1, first variable on that line
get vendor name value on line one, 2nd variable after comma
get callnum on line 2, first var
get date on line 2 second var
get account number on line 3 1st var
get company name on line 3 2nd var
get operator ID number on line 4 1st var
get call time on line 4 3rd var
get call type on line 5 1st var
get caller first name on line 5 2nd var
get caller last name on line 5 3rd var
}
Proceed with processing variables, totalling money etc.
Print information in a new file, and close.
Any assistance you can offer here would greatly be appreciated!
Thank you,
Scott Fleming
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 13 Oct 1999 17:04:01 +0200
From: "Laurent.Laperrousaz" <l.laperrousaz@net-clic.net>
Subject: GDBM write in CGI PERL
Message-Id: <7u27aq$9j0$1@jaydee.iway.fr>
I have a script that write to a GDBM file which works ok when started on a
command line but fails to work when launched by Apache. What is wrong ?
here are the few lines of the script:
#!/usr/bin/perl -w
use Fcntl;
use GDBM_File;
use Carp;
($file) = $ARGV[0];
($key) = $ARGV[1];
($val) = $ARGV[2];
($self)= GDBM_File::TIEHASH (GDBM_File,
$ARGV[0],GDBM_WRCREAT,0640,"fatal_func =croak");
GDBM_File::STORE $self, $ARGV[1], $ARGV[2];
untie ($class);
exit;
- through CGI/PERL:
* I can tie to GDM when it does not exist (open for write or create) and
then add a record
* Subsequent attempts to read or write fails because tiehash returns an
empty %hash
-through BASH/PERL
*Every write, every read is ok
If you know a way to set the TIEHASH verbose maybe I can step forward !
thank you again
------------------------------
Date: Wed, 13 Oct 1999 14:09:04 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: GDBM write in CGI PERL
Message-Id: <Pine.GSO.4.10.9910131408340.25558-100000@user2.teleport.com>
On Wed, 13 Oct 1999, Laurent.Laperrousaz wrote:
> I have a script that write to a GDBM file which works ok when started
> on a command line but fails to work when launched by Apache.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.cpan.org/
http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html
http://www.cpan.org/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 13 Oct 1999 15:12:32 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: GDBM write in CGI PERL
Message-Id: <380503D0.97A0FD2@mail.cor.epa.gov>
Laurent.Laperrousaz wrote:
>
> I have a script that write to a GDBM file which works ok when started on a
> command line but fails to work when launched by Apache. What is wrong ?
TomP already gave you some sage advice. But programs which
run from the command line and fail from the webserver often
overlook the difference in environments between 'you' and
whatever user the web process runs as. Stepping through the
"Idiot's Guide" is an easy way to make sure you've covered
the basics here.
http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 15 Oct 1999 14:08:56 GMT
From: krun@my-deja.com
Subject: Gettin Path except last dir
Message-Id: <7u7ch9$ig5$1@nnrp1.deja.com>
I have a list of Path names in an array and I was wondering how I could
get the whole path except for the last directory into another array.
The array of the whole pathname is called @path.
Example
C:\temp\first\second\third\fourth...
-This is the whole path
C:\temp\first\second\third
-This is what I need
The paths are of different lengths and different names.
THanx for all your help.
Krun
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 15 Oct 1999 16:28:57 +0200
From: A Zielke <azielke@hotmail.com>
Subject: Re: Gettin Path except last dir
Message-Id: <38073A29.90CA6943@hotmail.com>
How about a
my ( $ShortenedPath ) = ( $LongPath =~ /(.*)\\.+/ );
Andreas
krun@my-deja.com schrieb:
>
> I have a list of Path names in an array and I was wondering how I could
> get the whole path except for the last directory into another array.
> The array of the whole pathname is called @path.
>
> Example
>
> C:\temp\first\second\third\fourth...
> -This is the whole path
>
> C:\temp\first\second\third
> -This is what I need
>
> The paths are of different lengths and different names.
> THanx for all your help.
>
> Krun
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Fri, 15 Oct 1999 12:18:30 +0400
From: "Alexey Ryumin" <aryumin@copris.com>
Subject: Re: Getting Win Perl working with MS Personal Web Server
Message-Id: <7u6nu5$9i$1@news.glas.net>
Hi!
.pl c:\perl\bin\perl.exe %s %s
.plx c:\perl\bin\perlis.dll
Good luck!
Alexey Ryumin
d.k. henderson wrote in message <8E5773854dkhenderson@207.14.233.125> ...
>
>.cgi c:\perl\bin\perl.exe
------------------------------
Date: Fri, 15 Oct 1999 11:50:25 GMT
From: emlyn_a@my-deja.com
Subject: Ha ha!
Message-Id: <7u74du$cjj$1@nnrp1.deja.com>
> how annoying that you didn't even lift a finger to help her. what kind
> of gentleman perl hacker do you claim to be? as a fine upstanding
member
> of the clpm cabal, i must demand you unsubscribe from this group
> forthwith and never darken my towels again!
>
> uri
>
Ha ha! Thanks, Uri. Actually, I'm a guy like the rest of you (I know, I
know, the name is odd).
I've figured out that decoding to binary is the way to go, assuming it
works for all OS's.
E.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 15 Oct 1999 02:15:36 GMT
From: Ala Qumsieh <qumsieh@sympatico.ca>
Subject: Re: Hash size limit ? (longish)
Message-Id: <38068ECB.17957E7F@sympatico.ca>
Ilya Zakharevich wrote:
>
> To see (a pretty good guess of) how Perl parses your stuff, load CPerl
> and enable "hairy".
I must say, the features put in the latest CPerl are impressive. I
especially
like the auto-help. And, I especially hate the automatic closing of the
matching
bracket/parenthesis/brace. I know it's supposed to help, but after a
while I
found that it was annoying and hindering me. Guess I'll have to
customize it
for my taste.
Excellent work nevertheless. I recommend it.
--Ala
------------------------------
Date: 15 Oct 1999 04:32:25 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Hash size limit ? (longish)
Message-Id: <7u6aop$mea$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Ala Qumsieh
<qumsieh@sympatico.ca>],
who wrote in article <38068ECB.17957E7F@sympatico.ca>:
> ... while I found that it was annoying and hindering me. Guess I'll
> have to customize it for my taste.
Well, this is why the customization support was put there. ;-)
Ilya
------------------------------
Date: Wed, 13 Oct 1999 07:26:23 GMT
From: dVoon <dvoon@my-deja.com>
Subject: Re: Help - Perl regular expression question!
Message-Id: <7u1c6m$79j$1@nnrp1.deja.com>
$old = "abc";
$new = "xyz";
$line =~ s/\b$old\b/$new/g;
The above code works for changing $line
from "bc|||abc|||abcde|||abc|||zzzabczzz|||abc"
to "bc|||xyz|||abcde|||xyz|||zzzabczzz|||xyz"
However, I'm assuming that the "bigger pattern" that you were mentioning
about doesn't contain leading and tailing spaces. So, with the example
above it will also change $line
from "bc|||abc|||abcde||| abc |||zzzabczzz|||abc"
to "bc|||xyz|||abcde||| xyz |||zzzabczzz|||xyz"
(notice the leading and tailing spaces of the fourth field.
Hope this help.
Daniel
In article <7tgon1$m3s$1@nnrp1.deja.com>,
jennyng@my-deja.com wrote:
> Hi,
>
> I've spent days to try to get the following w/ no success. I was
> wondering if anyone knows how to do the following w/ Perl regular
> expression (or any other way w/ Perl):
>
> if (( $pattern in $line ) && ( $pattern in $line is not w/in [bigger
> pattern] )) {
> replace $pattern w/ $replacement
> }
>
> Example:
> $pattern = "bcd";
> [bigger pattern] is "abcde"
> $line = "lllbcdlllabcdelllbcd";
> $replacement = "wyz";
> The above will change $line to "lllwyzlllabcdelllwyz".
>
> Any help or suggestion is greatly appreciated. Thank you very much in
> advance.
>
> - Jenny
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
--
+--------------------------------------------+
| Reality is for people who lack imagination |
+--------------------------------------------+
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 13 Oct 1999 14:59:44 +0200
From: "Marco Cerqui" <marco.cerqui@alcatel.ch>
Subject: HELP --> Save output in a variable
Message-Id: <7u1vo3$bpo$1@pollux.ip-plus.net>
Hi
In a script I want to save the output of a command -->system(ypwhich)<--
into a variable. Can someone help me please ?
------------------------------
Date: Wed, 13 Oct 1999 15:15:12 +0200
From: BARBET Alain <abarb@nmg.fr>
To: Marco Cerqui <marco.cerqui@alcatel.ch>
Subject: Re: HELP --> Save output in a variable
Message-Id: <380485E0.FFEA9442@nmg.fr>
Marco Cerqui a écrit :
> Hi
> In a script I want to save the output of a command -->system(ypwhich)<--
> into a variable. Can someone help me please ?
You can redirect output in a file and then read it ... and you can have the
return code of your call with $retourcode=system("ypwhich>>/tmp/toto");
--
Alain BARBET
abarb@nmg.fr - http://www.citeweb.net/alian
------------------------------
Date: Wed, 13 Oct 1999 13:19:00 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: HELP --> Save output in a variable
Message-Id: <slrn8091u2.sqi.bmccoy@moebius.foiservices.com>
Also Sprach Marco Cerqui <marco.cerqui@alcatel.ch>:
>In a script I want to save the output of a command -->system(ypwhich)<--
>into a variable. Can someone help me please ?
Use backticks -> $result = `ypwhich`; If you use a list context, each line
of output will be an individaula element, else the entire thing gets
dumped into a single string -- be careful doing that. The generic form of
the back is the qx// operator.
Time to hit those docs, dude!
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Wed, 13 Oct 1999 16:02:42 +0100
From: Jason P Tribbeck <jtribbeck@argogroup.com>
Subject: Re: HELP --> Save output in a variable
Message-Id: <38049F12.55F58881@argogroup.com>
Marco Cerqui wrote:
> In a script I want to save the output of a command -->system(ypwhich)<--
> into a variable. Can someone help me please ?
To summarise `perldoc perlop`:
$result=`ypwhich`;
--
Jason Tribbeck Argo Interactive
ltd
Senior Design Engineer 7 Dukes Court,
Chichester
West Sussex, PO19
2FX
Tel: +44 1243 815 815 Fax: +44 1243 815 805
England
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 1060
**************************************