[19594] in Perl-Users-Digest
Perl-Users Digest, Issue: 1789 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 21 18:07:59 2001
Date: Fri, 21 Sep 2001 15:05:12 -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: <1001109911-v10-i1789@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 21 Sep 2001 Volume: 10 Number: 1789
Today's topics:
access old DIBOL file (jeremiah)
Re: access old DIBOL file <jeff@vpservices.com>
Re: copy STDERR to file (Charles DeRykus)
Re: Deleting variables (shaz)
Help in debugging perl DBD:DB2 problem. <shah@typhoon.xnet.com>
How to Call a Potentially Unending Command (Rick Kasten)
Re: How to get the path of current directory in perl nobull@mail.com
I am Impressed <nomail@please.com>
Re: Impossible to search and delete! <gnarinn@hotmail.com>
IndigoPerl using the wrong port?? (Mark)
Re: IndigoPerl using the wrong port?? <bart.lateur@skynet.be>
Newbie problem <yalaoui@lexbase.fr>
Re: Newbie problem <Laocoon@eudoramail.com>
Re: Peek and Poke on Perl? <goldbb2@earthlink.net>
Re: perl code compatibility <mjcarman@home.com>
Re: perl, lvalues, rvalues, and operators <gnarinn@hotmail.com>
Quick, easy definition help! <nomail@please.com>
Re: Quick, easy definition help! <Laocoon@eudoramail.com>
Re: Quick, easy definition help! <fiendy@claraNO-SPAM.co.uk>
Re: Quick, easy definition help! <jeff@vpservices.com>
Regular expression problem (Paul Minerva)
Re: Regular expression problem <Laocoon@eudoramail.com>
Re: Regular expression problem <rsherman@ce.gatech.edu>
Re: Regular expression problem <jurgenex@hotmail.com>
Re: Schwartzian Transform problem <bart.lateur@skynet.be>
Re: Schwartzian Transform problem <matthew.garrish@sympatico.ca>
Transfer localtime to MET <flm.vd.valk@wanadoo.nl>
Re: using a variable to call a function <ren@tivoli.com>
Re: using a variable to call a function <ren@tivoli.com>
variables inside patterns? (bowen hui)
Re: variables inside patterns? <swessels@usgn.net>
Re: who said this? <peter_icaza@REMOVE2REPLYuhc.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Sep 2001 14:03:28 -0700
From: brimstonesfc@hotmail.com (jeremiah)
Subject: access old DIBOL file
Message-Id: <4a7434b6.0109211303.794f401f@posting.google.com>
I've got a bit of a problem. I need to acces an old DIBOL db via perl.
I can't seem to find much on the the net concerning DIBOL and searches
on cpan for existing modules didn't yield any thing that directly
relates to my problem. I'm considering just something with DBI but am
at a loss to how the data is writen by DIBOL. Any suggestions? Any
clues where I can find some helpful info? THanks
Jeremiah
------------------------------
Date: Fri, 21 Sep 2001 14:29:59 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: access old DIBOL file
Message-Id: <3BABB157.D3D2BDC0@vpservices.com>
jeremiah wrote:
>
> I've got a bit of a problem. I need to acces an old DIBOL db via perl.
> I can't seem to find much on the the net concerning DIBOL and searches
> on cpan for existing modules didn't yield any thing that directly
> relates to my problem. I'm considering just something with DBI but am
> at a loss to how the data is writen by DIBOL. Any suggestions? Any
> clues where I can find some helpful info? THanks
From what I can gather DIBOL is a language, not a database format, so do
you have a program with data embedded in it, or some sort of output from
a program? If you have a one-time task, you'll probably want to parse
out the data into some sort of flat file format and then either import
that into an rdbms or handle it directly with, for example
DBD::AnyData. If this is something you are going to do often you might
consider making an AnyData::Format plug-in that would allow you to query
the data without the intermediate step of creating a flat file. If you
opt for that, let me know and I'll see if I can help.
--
Jeff
------------------------------
Date: Fri, 21 Sep 2001 17:45:49 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: copy STDERR to file
Message-Id: <GK0xCD.FyC@news.boeing.com>
In article <t5fiqtck2r71g81rmqkjjcq7p94lfg1d1s@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>Rory wrote:
>
>...
> open SAVEERR, ">&STDERR";
> open STDERR, "> stderr.txt";
> warn "This goes to the file";
> open STDERR, ">&SAVEERR";
> warn "This goes to the old STDERR";
>
>It works, apart from this warning:
>
> Name "main::SAVEERR" used only once: possible typo at test.pl line 2.
>
>Grrr. Silly perl.
>
{ no warnings 'once'; open SAVEERR, ">&STDERR"; }
( open SAVEERR, ">&STDERR"; *SAVEERR = *SAVEERR; #older Perl ver. )
A "Grrr" antitdote :)
--
Charles DeRykus
------------------------------
Date: 21 Sep 2001 14:46:04 -0700
From: ssa1701@yahoo.co.uk (shaz)
Subject: Re: Deleting variables
Message-Id: <23e71812.0109211346.20261bc7@posting.google.com>
> > Because the variable $words contains two words, how would I delete it
> > from @store if ONE or BOTH of the words are in @list?
>
> See:
>
> perldoc -q contains
>
> > while (/(\w+)($look)/g)
> > {
> > $store{$1}++;
> > delete @store{@list};
> > }
>
> You are probably better off with a hash of forbidden words, not an array.
> You also probably want to take the delete() out of your loops - either fix
> %store at the end, or don't even add the word if if fails the forbidden word
> check.
>
> --Ben Kennedy
How could I check to see if the word is forbidden in the while check
(ie while (/(\w+)($look)/g) ). I would prefer it this way, so I can
omit strings that are numbers.
------------------------------
Date: Fri, 21 Sep 2001 21:49:39 +0000 (UTC)
From: Hemant Shah <shah@typhoon.xnet.com>
Subject: Help in debugging perl DBD:DB2 problem.
Message-Id: <9ogclj$fvr$1@flood.xnet.com>
Folks,
I need help in debugging a problem. I have spent several days trying to
figure out the problem.
Here is the back ground. I have 3 RS/6000 systems configured with same
version and patchlevel of perl 5.6.0, DB2 UDB 6.1, and DBD, DBI and DB2
drivers. My perl script is called from a SUID/SGID program. On 2 systems
it works fine. On one of the systems it dies with following error message:
"Total Environment allocation failure"
while connecting to the database.
I can run my script from the command line (with -T switch) without any
problem, but it fails if I call it from the SUID/SGID program.
I turned on the the DBI trace and ran the script from command line, and
I got following trace:
DBI 1.13-nothread dispatch trace level set to 1
-> DBI->connect(dbi:DB2:GBLCODE, , , )
-> DBI->install_driver(DB2) for perl=5.006 pid=144218 ruid=4504 euid=4504
install_driver: DBD::DB2 loaded (version 0.73)
<- install_driver= DBI::dr=HASH(0x200dbd6c)
<- connect= DBI::db=HASH(0x201d7d50) at DBI.pm line 382.
<- STORE('PrintError', 1)= 1 at DBI.pm line 407.
<- STORE('AutoCommit', 1)= 1 at DBI.pm line 407.
<- connect= DBI::db=HASH(0x201d7d50)
<- STORE('AutoCommit', 0)= 1 at GblCodeDB.pm line 357.
<- STORE('PrintError', 1)= 1 at GblCodeDB.pm line 360.
<- STORE('RaiseError', 1)= 1 at GblCodeDB.pm line 361.
.
.
.
.
.
When I ran the same script from a SUID/SGID program I get following trace:
DBI 1.13-nothread dispatch trace level set to 1
-> DBI->connect(dbi:DB2:GBLCODE, , , )
-> DBI->install_driver(DB2) for perl=5.006 pid=72840 ruid=645 euid=4504
install_driver: DBD::DB2 loaded (version 0.73)
<- install_driver= DBI::dr=HASH(0x200dc5b4)
<- connect= undef at DBI.pm line 382.
<- errstr= 'Total Environment allocation failure! (DBD: Total Environment allocation failure!)' at DBI.pm line 383.
DBI->connect failed: Total Environment allocation failure! (DBD: Total Environment allocation failure!) at /d1/gblcode/cob/sec/dynlib/LIDP/GblCodeDB.pm line 350
DBI->connect failed: Total Environment allocation failure! (DBD: Total Environment allocation failure!)
<- DESTROY= 1 at GblCodeDB.pm line 351.
<- disconnect_all= 1 at DBI.pm line 424.
<- DESTROY= undef during global destruction.
Any help will be appreciated.
Thanks
--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: NoJunkMailshah@xnet.com \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
------------------------------
Date: 21 Sep 2001 12:02:28 -0700
From: rckjr@yahoo.com (Rick Kasten)
Subject: How to Call a Potentially Unending Command
Message-Id: <4ecf6f35.0109211102.52487071@posting.google.com>
I have to write a script where I make a call to a database utility.
If the utility runs through to the SQL> prompt, everything is ok and I
can exit. If the utility does not display the SQL> prompt within a
given amount of time (~60 sec), the database is considered hung, and
then I have to continue the script which kills and restarts the
database. My question is how do I do this? If I do
open(DB,"dbutil |");
while (<DB>) {
if (/^SQL/) {
whatever;
}
}
then if the database is hung I'll sit forever waiting for the next
line of output from dbutil. But dbutil doesn't actually exit if the
database is not hung - all that happens is I get the SQL> prompt. So
I can't do a fork and wait for the child to finish, because either
way, it never closes.
Any ideas?
------------------------------
Date: 21 Sep 2001 19:06:38 +0100
From: nobull@mail.com
Subject: Re: How to get the path of current directory in perl
Message-Id: <u9bsk4e7v5.fsf@wcl-l.bham.ac.uk>
news@roaima.demon.co.uk writes:
> nobull@mail.com wrote:
> > I don't understand why you think the OP needs their code to run under
> > Perl4. (Under Perl5 getcwd.pl is superceeded by Cwd.pm).
>
> It's in my perl5 distribution, therefore it's quite likely that it's in
> theirs too.
Yes, pretty much everything you need to run scripts written in Perl4
is in the Perl5 distribution.
This does not mean that it is appropriate when someone posts a
question saying "How do I do X in Perl?" that you should tell them how
to would have been done in Perl4.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 21 Sep 2001 17:55:28 -0400
From: "Victor Menendez" <nomail@please.com>
Subject: I am Impressed
Message-Id: <DAOq7.10476$2H2.805096@e3500-atl1.usenetserver.com>
I am new to perl and have been rushed on a project. So I apologize for my
naiveness.
I must tell you that I am absolutely impressed at your immediate and concise
response.
I see now that the Perl group is an enthusiastic group, willing to help
fellow interested parties.
Thank you very much for that. I hope in the months to come I can contribute
and assist others as you guys have myself.
Laocoon, Fiendy, Jeff Zucker
Thanks
"Victor Menendez" <nomail@please.com> wrote in message
news:jSNq7.10455$2H2.799285@e3500-atl1.usenetserver.com...
> Can someone please define this.
>
> $name =~ s/\"//g;
>
> I appreciate it.
>
>
>
>
------------------------------
Date: Fri, 21 Sep 2001 18:50:53 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Impossible to search and delete!
Message-Id: <1001098253.164557978976518.gnarinn@hotmail.com>
In article <R1nq7.42$ta7.4746@newsb.telia.net>,
Kalle Anka <kalle.anka@markisspecialisten.com> wrote:
>I cant figure how to to edit my e-mail list by search and delete i Perl.
>
>For examle:
>I want to delete someone@somewere.com
>I I whrite for example com, all the addresses with .com deletes.
(incomprehensible cgi script snipped)
when asking here for help reguarding some problem you have,
it is always a good idea to simplify it first.
make a minimal script that demonstrates your problem , without
involving us in details we would rather not be aware of, like
lots of conditional html output, email urls and so on
if possible, a non-cgi script.
for example, in your case (if i understood it correctly) try a simple
script that reads a file with some lines of text,
and writes out those lines that match to another file.
if you have problems in that stage, then by all means ask here,
but first take a look in the FAQs to see if you are going to be flamed.
for example, does
perldoc -q "delete a line in a file"
answer your question?
if you still have problems, make sure you mention in your post that
you read the faq, but did not understand it, or did not think it applies
to your problem because so and so.
when you post code that does not do what you want, make sure
to tell us in what way it fails:
"i thought this would happen, but this happened"
try again
gnari
------------------------------
Date: Thu, 20 Sep 2001 14:22:19 GMT
From: mark@artwarren.co.ukNOSPAM (Mark)
Subject: IndigoPerl using the wrong port??
Message-Id: <3ba9fb85.2012947@news.screaming.net>
Hi,
I have installed IndigoPerl on my PC under Win98, but when I select
'start apache' the following error message appears in the dos window;
Syntax error on line 237 of c:/program
files/indigoperl/conf/httpd.conf:
The port number "Files\IndigoPerl\setup.bat" is outside the
appropriate range (i.e., 1..65535).
Can anyone advise what this means and how I can cure this problem?
Thanks in advance.
Mark
------------------------------
Date: Fri, 21 Sep 2001 19:17:38 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: IndigoPerl using the wrong port??
Message-Id: <da4nqtklqmmd0pndug2uimnbd5s24ois64@4ax.com>
Mark wrote:
>I have installed IndigoPerl on my PC under Win98, but when I select
>'start apache' the following error message appears in the dos window;
>Syntax error on line 237 of c:/program
>files/indigoperl/conf/httpd.conf:
>The port number "Files\IndigoPerl\setup.bat" is outside the
>appropriate range (i.e., 1..65535).
How did you install it? Did you, by any chance, mess with httpd.conf?
>Can anyone advise what this means and how I can cure this problem?
It means that the port number to use is outside the 16 bit range. The
normal value for a web server is 80, while PerlConsole, also part of the
IndigoPerl distribution, uses 4444.
So go to the directory "conf" in the IndigoPerl's file root, open the
file httpd.conf with a text editor. Search for the word "port". On my
configuration file, it's on line 237. That line is
Port 80
thus normal for a normal http server. Modify that line until reasonable,
and save the file. Then start Apache again.
--
Bart.
------------------------------
Date: Fri, 21 Sep 2001 23:13:27 +0200
From: "Younes ALAOUI" <yalaoui@lexbase.fr>
Subject: Newbie problem
Message-Id: <9ogaib$s4$2@wanadoo.fr>
Hi,
I have this error and i cannot help myself in resolving, can someone help me
:
Can't locate MIME/Parser/Reader.pm in @INC (@INC contains:
/usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0
/usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl/5.005 /usr/lib/perl5/site_perl) at
/usr/lib/perl5/site_perl/5.6.0/MIME/Parser.pm line 151. BEGIN
failed--compilation aborted at /usr/lib/perl5/site_perl/5.6.0/MIME/Parser.pm
line 151.
Thanks in advance
mailto: younes@lexbase.fr
------------------------------
Date: Fri, 21 Sep 2001 23:18:19 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Newbie problem
Message-Id: <Xns9123EE6D85142Laocooneudoramailcom@62.153.159.134>
"Younes ALAOUI" <yalaoui@lexbase.fr> wrote in
news:9ogaib$s4$2@wanadoo.fr:
> Hi,
>
> I have this error and i cannot help myself in resolving, can someone
> help me
>:
>
> Can't locate MIME/Parser/Reader.pm in @INC (@INC contains:
> /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0
> /usr/lib/perl5/site_perl/5.6.0/i386-linux
> /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl/5.005
> /usr/lib/perl5/site_perl) at
> /usr/lib/perl5/site_perl/5.6.0/MIME/Parser.pm line 151. BEGIN
> failed--compilation aborted at
> /usr/lib/perl5/site_perl/5.6.0/MIME/Parser.pm line 151.
>
You have not installed or have not properly installed
the MIME::Parser module.. Install the module in the right
directory.. you can download the module from CPAN :
http://search.cpan.org/search?mode=module&query=MIME%3A%3AParser
------------------------------
Date: Fri, 21 Sep 2001 17:25:50 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Peek and Poke on Perl?
Message-Id: <3BABB05D.BE0D6DD0@earthlink.net>
[mailed and posted]
Gary wrote:
>
> I have built some circuit boards which reside at one of the classic
> PC locations of a000, b000, c000, d000 or e000. I have been using
> (as was the intention) DOS to operate the board and have written
> a driver for it. During the time I was designing and building these
> boards I was introduced to Perl. I decided to use Perl and Tk to
> create an "applications generator" for the boards. That is, a user
> may select from various options, etc. The application runs fine.
>
> In fact, Perl has impressed me so much that I have been thinking to
> give it a try running the boards also. What I need in order to do
> that are two functions identical to "peek" and "poke". I know Windows
> is running protected mode, so one can't simply peek and poke. Is
> there a module available for Perl which provides such functionality?
> I have searched CPAN and a general web search, but either must be
> entering the wrong search criteria or perhaps, it doesn't exist.
>
> Any help on locating such a module would be greatly appreciated.
> Thanks in advance.
I would suggest using Inline::C to embed C code into your perl program.
This allows you to achieve much of the same effects as using xs, but
without the hassle.
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: Fri, 21 Sep 2001 15:20:28 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: perl code compatibility
Message-Id: <3BABA10C.2ECD0450@home.com>
Peter Cameron wrote:
>
> We've been developing some Perl code using Perl 5.005. Would there
> be any problems running the code with Perl 5.004 and Perl 5.6 and
> later?
Maybe. I wouldn't expect any issues going from 5.005 to 5.6, but you may
have problems going from backwards to 5.004. Read the perldelta manpage
in your 5.005 distribution for a summary of what changed. As long as you
avoid depending on those features, your code should run under the older
version.
> We're wanting to establish the base version of Perl that our
> clients would need. On Solaris 2.6, for example, Perl 5.004 is
> all we've found.
Is that what's included in the Solaris distribution? There shouldn't be
any problems for your clients to build either 5.005 of 5.6 from the
source. Convincing them to do so might be another matter.
> My feeling is to be on the safe side and say 5.005 upwards.
Agreed. There were a number of problems with 5.004 (some involving
security, IIRC) that were fixed in 5.005. I wouldn't recommend using
anything older.
-mjc
------------------------------
Date: Fri, 21 Sep 2001 19:21:59 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: perl, lvalues, rvalues, and operators
Message-Id: <1001100119.892214161343873.gnarinn@hotmail.com>
In article <m3bsk5yyti.fsf@thneed.na.wrq.com>,
Michael Slass <mikesl@wrq.com> wrote:
>If you want to do regexp substitution on a string, of course you do
>
>$mystring =~ s/regex/subst/
>
>This assumes that mystring is an lvalue, because it does the
>substitution in place. Is there any kind of regexp substituion
>operator that can work on rvalues - that is, use of this operator
>doesn't change the value on the left, but instead the entire
>expression returns a value (the string as processed by the
>substitution operator)?
>
>so if the mystery operator is ##, I could do:
>
>$mystring = ($some_constant_string ## s/regex/subst/)
do you mean
($mystring = $some_constant_string) =~ s/regex/subst/;
?
gnari
------------------------------
Date: Fri, 21 Sep 2001 17:06:04 -0400
From: "Victor Menendez" <nomail@please.com>
Subject: Quick, easy definition help!
Message-Id: <jSNq7.10455$2H2.799285@e3500-atl1.usenetserver.com>
Can someone please define this.
$name =~ s/\"//g;
I appreciate it.
------------------------------
Date: Fri, 21 Sep 2001 23:14:03 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Quick, easy definition help!
Message-Id: <Xns9123EDB45B8B2Laocooneudoramailcom@62.153.159.134>
s/\"//g
It deletes all occurences of "
------------------------------
Date: Fri, 21 Sep 2001 22:25:56 +0100
From: "Fiendy" <fiendy@claraNO-SPAM.co.uk>
Subject: Re: Quick, easy definition help!
Message-Id: <fdOq7.74985$TB2.6091166@nnrp4.clara.net>
"Victor Menendez" <nomail@please.com> wrote in message
news:jSNq7.10455$2H2.799285@e3500-atl1.usenetserver.com...
> Can someone please define this.
>
> $name =~ s/\"//g;
>
> I appreciate it.
>
What it does is remove all occurrences of the double-quote character ("),
from the contents of the $name variable.
Syntax: s/<thing to replace>/<what to replace with>/<switches>
The <thing to replace> is a double-quote in this case, <what to replace> is
nothing, & the 'g' switch tells Perl to do a global replace IE if you didn't
use the switch, then it would replace only the first occurence of a
double-quote.
Hope that explains it clear enough!
Fiendy.
------------------------------
Date: Fri, 21 Sep 2001 14:34:16 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Quick, easy definition help!
Message-Id: <3BABB258.34322EC@vpservices.com>
Victor Menendez wrote:
>
> Can someone please define this.
>
> $name =~ s/\"//g;
>
> I appreciate it.
s/// is the substitution operator. see the perlop man page. It
substitutes one pattern for another. In this case it substitutes
nothing for a quote mark and does so globally (because of the g) over
the whole pattern. So if $name previously had the value foo"bar"baz,
after that statement it would have the value foobarbaz. The backslash
in your example appears to be spurious.
--
Jeff
------------------------------
Date: 21 Sep 2001 13:57:26 -0700
From: paulminerva@yahoo.com (Paul Minerva)
Subject: Regular expression problem
Message-Id: <baa5a435.0109211257.4bcf632d@posting.google.com>
I am receiving a string back from a function that has the following format.
Stock Symbol + quote + stock symbol
e.g.
MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT
I need a way to use backtracing in a regular expression that will retrieve for me
MSFT80.00MSFT
IBM80.00IBM
MSFT80.00MSFT, etc.
not
MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT
I am currently getting the latter result and not the former.
Thanks
------------------------------
Date: Fri, 21 Sep 2001 23:12:32 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Regular expression problem
Message-Id: <Xns9123ED72DF8E5Laocooneudoramailcom@62.153.159.134>
paulminerva@yahoo.com (Paul Minerva) wrote in
news:baa5a435.0109211257.4bcf632d@posting.google.com:
*snip*
> I need a way to use backtracing in a regular expression that will
> retrieve for me
>
> MSFT80.00MSFT
> IBM80.00IBM
> MSFT80.00MSFT, etc.
>
> not
>
> MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT
*snip*
So u just want to put in newlines instead of spaces?
$text =~ s/ /\n/g;
Or u meant something else?
------------------------------
Date: Fri, 21 Sep 2001 17:22:53 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: Regular expression problem
Message-Id: <3BAB311D.283B5452@ce.gatech.edu>
Paul Minerva wrote:
>
> I am receiving a string back from a function that has the following format.
>
> Stock Symbol + quote + stock symbol
>
> e.g.
>
> MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT
>
> I need a way to use backtracing in a regular expression that will retrieve for me
>
> MSFT80.00MSFT
> IBM80.00IBM
> MSFT80.00MSFT, etc.
>
> not
>
> MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT
>
> I am currently getting the latter result and not the former.
>
> Thanks
for (split / /,$string){ print $_."\n" } ###split on space
or
$string =~ s/\s+/\n/g; ###swap whitepace characters for newline
print $string;
--
robert sherman
css, cee
georgia institute of technology
atlanta, ga, usa
------------------------------
Date: Fri, 21 Sep 2001 14:28:47 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Regular expression problem
Message-Id: <3babb11a$1@news.microsoft.com>
"Paul Minerva" <paulminerva@yahoo.com> wrote in message
news:baa5a435.0109211257.4bcf632d@posting.google.com...
> I am receiving a string back from a function that has the following
format.
> Stock Symbol + quote + stock symbol
> e.g.
>
> MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT
>
> I need a way to use backtracing in a regular expression that will retrieve
for me
>
> MSFT80.00MSFT
> IBM80.00IBM
> MSFT80.00MSFT, etc.
$_ = "MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT IBM80.00IBM MSFT80.00MSFT";
my @list = split;
should do the job, no need for REs.
jue
------------------------------
Date: Fri, 21 Sep 2001 21:22:23 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Schwartzian Transform problem
Message-Id: <dnbnqt41r2l3b5pssk1i3p2m79ujfkfuml@4ax.com>
Matt Garrish wrote:
>And yes, my gripe was
>with seeing (virtually) the exact same post a second time; it's one of my
>pet peeves. If you're going to respond to someone, take the time to read the
>thread through.
As Anno said: Randal's post might simply not have appeared in Michael's
newsfeed. I rarely ever see a post from M.J. Dominus. I don't know why.
--
Bart.
------------------------------
Date: Fri, 21 Sep 2001 17:33:26 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Schwartzian Transform problem
Message-Id: <FiOq7.33249$Zb4.3454457@news20.bellglobal.com>
"Michael Carman" <mjcarman@home.com> wrote in message
news:3BAB5C3C.14BB4E31@home.com...
>
> That was not my intent
Then accept my apologies as well. I can take being wrong, but your message
just seemed a bit crass coming as it did after the previous. I shudder at
the sudden thought that I'm becoming like Godzilla!
Matt
------------------------------
Date: Fri, 21 Sep 2001 21:09:21 GMT
From: "F.L.M. van der Valk" <flm.vd.valk@wanadoo.nl>
Subject: Transfer localtime to MET
Message-Id: <50Oq7.175$xX5.703@castor.casema.net>
In a Perl-program I use for a scouting-website is mentioned :
$sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$long_date = sprintf("%s %02d, %4d at
%02d:%02d:%02d",$months[$mon],$mday,$year,$hour,$min,$sec);
The server is in the USA so, time difference is 6 hrs.
How can I change it, so the MET (The Netherlands) is mentioned.
------------------------------
Date: 21 Sep 2001 14:39:27 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: using a variable to call a function
Message-Id: <m3vgicgwpc.fsf@dhcp9-161.support.tivoli.com>
On 21 Sep 2001, ccsam@bath.ac.uk wrote:
> I am trying to use a variable to make up part or all of a function
> name. I have tried:
>
> 1 #!/usr/bin/perl -w
> 2
> 3 use strict;
> 4
> 5 {
> 6 my $func = shift or die "usage: $0 [function-name]\n";
> 7 &foo ($func);
> 8 }
> 9
> 10 sub foo {
> 11 my $f = shift;
> 12 &\$f(); # How do you call a function using a
> variable?
> 13 }
> 14
> 15 sub bar {
> 16 my $p = shift;
> 17 print $p; # do I need to access this as reference?
> 18 }
> 19
>
> and many more "hacks". The two offending lines are 12 and 16.
$f->(); # or &$f();
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 21 Sep 2001 14:43:08 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: using a variable to call a function
Message-Id: <m3r8t0gwj7.fsf@dhcp9-161.support.tivoli.com>
On 21 Sep 2001, ren@tivoli.com wrote:
> On 21 Sep 2001, ccsam@bath.ac.uk wrote:
>
>> I am trying to use a variable to make up part or all of a function
>> name. I have tried:
[attempts snipped]
Previously, I said:
> $f->(); # or &$f();
but I didn't notice that you were trying to use a variable that had
the *name* of a function. I thought you were using function
references, which is what you should do -- or use a dispatch table if
you really need to lookup by name. A google search on "perl dispatch
table" should get you going.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 21 Sep 2001 20:36:24 GMT
From: bowen@cs.toronto.edu (bowen hui)
Subject: variables inside patterns?
Message-Id: <2001Sep21.163624.18319@jarvis.cs.toronto.edu>
hi,
i was wondering if anyone knows how i might be able to use variables
when i'm pattern matching? i tried the obvious, which is something like:
$verb = "run|swim|walk";
if( $input =~ /he $verb/ )
...
this doesn't work. so i tried to capture a word and then check it against
an array instead:
$verb ...
@VERB = split /\|/, $verb;
if( $input =~ /he ([a-zA-Z]+)/ )
...
and then check to see that whatever i captured matches something inside
the array. this doesn't seem the most direct solution... does anyone know
of a better solution?
thanks in advance,
bowen
------------------------------
Date: Fri, 21 Sep 2001 21:17:41 GMT
From: "Scott Wessels" <swessels@usgn.net>
Subject: Re: variables inside patterns?
Message-Id: <V7Oq7.40763$aZ6.10277996@news1.rdc1.az.home.com>
"bowen hui" <bowen@cs.toronto.edu> wrote in message
news:2001Sep21.163624.18319@jarvis.cs.toronto.edu...
> hi,
>
> i was wondering if anyone knows how i might be able to use variables
> when i'm pattern matching? i tried the obvious, which is something like:
>
> $verb = "run|swim|walk";
> if( $input =~ /he $verb/ )
> ...
wrap your verbs in parens, eg. $verb = "(run|swim|walk)"
this also gives the added benefit of capturing the verb,
for further processing if necessary, if not use (?:run|swim|walk)
------------------------------
Date: Fri, 21 Sep 2001 14:49:41 -0400
From: peter <peter_icaza@REMOVE2REPLYuhc.com>
Subject: Re: who said this?
Message-Id: <3BAB8BC5.941F5BC@REMOVE2REPLYuhc.com>
* Tong * wrote:
> Hi,
>
> I remember a saying like:
>
> In the windoze world, I am limited by the tools that I can use, In
> Unix, I am limited by my own wisdom.
>
> I want to know who said it (I know he is very famous), and I want to
> know the original quote. Thanks
>
> --
> Tong (remove underscore(s) to reply)
> *niX Power Tools Project: http://xpt.sourceforge.net/
> - All free contribution & collection
i did not say this first, but i will say it again
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1789
***************************************