[11313] in Perl-Users-Digest
Perl-Users Digest, Issue: 4913 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 17 09:07:21 1999
Date: Wed, 17 Feb 99 06:00:28 -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 Wed, 17 Feb 1999 Volume: 8 Number: 4913
Today's topics:
"Timeout" on opening a device? <Claudio.Strizzolo@trieste.infn.it>
Re: @files = <*.*>; doesn't work <jcounts@voicenet.com>
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
data entry templates (Matthew Fleming)
DBD::Oracle, Apache DBI, mod_perl <kucerar@hhmi.org>
Re: delete line? <allan@due.net>
Re: Finding a hash key based on regexp (Bart Lateur)
Re: good code vs code that works <23_skidoo@geocities.com>
Re: good code vs code that works <Philip.Newton@datenrevision.de>
Help - Perl Binaries for old SCO UNIX rel 3.2v4 <etandean@geocities.com>
Re: Help - Perl Binaries for old SCO UNIX rel 3.2v4 (Clay Irving)
Help,,, (Apache server) (Bababozorg)
Re: Help,,, (Apache server) <Allan@due.net>
Re: Help,Perl Script doesn't work! (Simon Roulstone)
Re: How do you copy a text file to the body of an e-mai <no@not.net>
Re: Perl evangelism ran@netgate.net
Perl for Windows interface ? <seccoza@mweb.co.za>
Problem with oraperl in a web-browser schoedema@my-dejanews.com
regex: closest occurrence of two words? nospam5@yahoo.com
Re: regex: closest occurrence of two words? (Sam Holden)
Re: Regular expression for Currency ??? <Philip.Newton@datenrevision.de>
Re: reverse ? <spamsux-tex@habit.com>
Re: reverse ? (Bart Lateur)
Re: reverse ? <Allan@due.net>
Re: Server Software (Tad McClellan)
Speed Up Perl pvdkamer@inter.NL.net
STDERR of system call in variable? <ste@hl.siemens.de>
Tk causes perlglob windows in NT <mdr@server1.smb.man.ac.uk>
Web Browser Setup <rlaflamm@sscinc.com>
Re: WWW Hosting for a site in need of CGI (Bababozorg)
Re: y2k problems with perl (Tad McClellan)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 17 Feb 1999 14:43:53 +0100
From: Claudio Strizzolo <Claudio.Strizzolo@trieste.infn.it>
Subject: "Timeout" on opening a device?
Message-Id: <36CAC799.167E@trieste.infn.it>
Hi all,
I am writing a small script to send messages to connected
terminals, from root account on a Digital Unix machine.
A portion of the code follows:
if (open(TERMINAL,">$terminal")) {
print TERMINAL sprintf("TEST\n\r");
close(TERMINAL);
}
$terminal is something like "/dev/ttyp3" or such. I get the list of
terminals through the "who" command. From time to time, due to a
malfunctioning in the upgrading of the file which "who" reads to
get the list of terminals, the list of terminals I try to "open"
is not up-to-date. In particular, some of the terminals might be
unavailable (i.e.: dead long time ago), though they are still
identified as available by "who". When I try to "open" the connection
to such a terminal, it hangs and stays there forever.
I am looking for a way to avoid this. Maybe a kind of timeout
on the "open" function? Any hints?
Thanks in advance
Claudio Strizzolo
------------------------------
Date: Wed, 17 Feb 1999 02:55:29 -0500
From: "John Counts" <jcounts@voicenet.com>
Subject: Re: @files = <*.*>; doesn't work
Message-Id: <7adt4d$ppp$1@news1.fast.net>
I had the same experience, except that I am running on NT server, same
version of Activeperl.
I had to change @files = glob("//s1/vol3/now/*.TXT"); to
opendir(G, "//s1/vol3/now");
I'm puzzled too!!
Steven Lee wrote in message ...
>I am running Perl version 5.005_02, build 509 with 1 registered patch
>by ActiveState. The filename glob operator does not seem to work on
>Windows 95.
------------------------------
Date: Wed, 17 Feb 1999 11:24:53 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage919250641.21371@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 10 Sep 1998
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://cpan.perl.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://cpan.perl.org/
http://www.perl.com/CPAN/
http://cpan.perl.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:
setdir usenet-by-group/news.announce.newusers
send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 17 Feb 1999 13:28:51 GMT
From: mgf@post.its.mcw.edu (Matthew Fleming)
Subject: data entry templates
Message-Id: <7aeg6j$fak@wiscnews.wiscnet.net>
Netters,
I am new to perl, so forgive the following question if it has an
obvious answer which I have overlooked. I need a tool for making
full-screen, character-based, data entry templates. I have been using
perlmenu, which can be made to do what I want. However, I have been
unable to get it to work quite the way the documentation says it
should. The perlmenu I'm using is from 1997. Is there another, more
up-to-date version of this, or another module with the same purpose?
Thanks,
Matthew Fleming
------------------------------------------------------------------------------
Matthew G. Fleming, MD phone : 414.456.4072
Associate Professor fax : 414.456.6518
Department of Dermatology s-mail: Dept. of Dermatology
Medical College of Wisconsin Medical College of Wisconsin
MFRC Room 4061
e-mail: mgf@mcw.edu Milwaukee, WI 53226-4810
------------------------------------------------------------------------------
Decency is the ultimate civic virtue -- Christopher Lasch
------------------------------
Date: Wed, 17 Feb 1999 08:05:29 -0500
From: "Kucera, Rich" <kucerar@hhmi.org>
Subject: DBD::Oracle, Apache DBI, mod_perl
Message-Id: <349D1A436757D211940C00805F15B54002BA5175@exchange1.hhmi.org>
Check the permissions...make sure they're rwxrwxrwx (try r--r--r--).
Web servers run themselves as nobody...
> -----Original Message-----
> From: Al Funk [SMTP:afunk@dailydrill.com]
> '/usr/lib/perl5/site_perl/5.005/i686-linux/auto/DBD/Oracle/Oracle.so'
> for module DBD::Oracle: libclntsh.so.1.0: cannot open shared object
> file: No such file or directory at
> /usr/lib/perl5/5.00502/i686-linux/DynaLoader.pm line 169.
>
> The file Oracle.so exists.
>
> However, running the same code from the command line does not cause
> any
> problem, even with the identical environment variables!
------------------------------
Date: Wed, 17 Feb 1999 06:28:05 -0500
From: "Allan M. Due" <allan@due.net>
Subject: Re: delete line?
Message-Id: <pJxy2.90$986.1494@nntp1.nac.net>
dan wrote in message <36CA563C.19CE6D95@mailcity.com>...
:lets say i have the following in a file:
:a
:b
:c
:d
:and i pass a variable through. the variable contains "b", how do i get
:rid of the line that b is on instead of replacing it with ""? so the
:file contains:
:a
:c
:d
:thanks
I still think the FAQ's should be called SHF (Start Here First)
see perlfaq5
How do I change one line in a file/delete a line in a file/insert a line in
the middle of a file/append to the beginning of a file?
HTH
AmD
------------------------------
Date: Wed, 17 Feb 1999 10:14:18 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Finding a hash key based on regexp
Message-Id: <36cf8fc6.4873769@news.skynet.be>
Zack wrote:
>Is it possible to find a matching hash key without using
> while ( ($key,$value) = each %hash ) {
> }
>I'd love for there to be a way to do a find on the key using a regexp ....
>ie:
> if (exists $hash{/(whatever)/} ) ...
>I know that syntax is never gonna work, but is there some other similar way?
>The tied hash I'm working with has 72,000 keys (and more being added).
>Searches are starting to bog down a bit.
You don't say!
Actually, if there WAS native support, it probably wouldn't be faster
than your approach: it will have to go through all the keys, and check
if any of the keys matches a regex.
This is the closest I get:
@matchkeys = grep { /(whatever)/ ) keys %hash;
or maybe even:
%match = map { /(whatever)/?($_ => $hash{$_}):() } kays %hash;
which uses a map+grep simulated in just a map.
Now, if there's a certain logic to the matches you're trying to
accomplish, you could build some index. For example, if you're searching
for a start letter, you could build an index for each letter, with as
value an array of all keys that start with this letter. You might end up
with an average tenfold increase speed, as compared to the original.
Check out the "full-text search in Perl" article in DDJ jan 1999 for
some inspiration, and get the demo source from the DDJ site.
HTH,
Bart.
------------------------------
Date: Wed, 17 Feb 1999 10:32:45 +0000
From: 23_skidoo <23_skidoo@geocities.com>
Subject: Re: good code vs code that works
Message-Id: <36CA9AC8.57E1@geocities.com>
Greg Ward wrote:
>
> 23_skidoo <23_skidoo@geocities.com> wrote:
> >
> > foreach local $user (@badusers)
> >
> > doesn't work, are variables local by default when used in a foreach
> > loop? if not, how can i localise them so that i can cut and paste subs
> > into other programs without worrying that i might corrupt a global
> > variable?
>
> Ooh, yuck, you should not use local unless you really know why --
> generally, you only want it on Perl's builtin "special variables". For
> your own variables, use "my". And "use strict" to make *sure* that you
> use "my".
ok, i went back and read up on local and my, i thought they were the
same thing but i see now that they're not. thanks for the advice :)
-23
p.s. thanks to everyone else who answered.
------------------------------
Date: Wed, 17 Feb 1999 14:10:00 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: good code vs code that works
Message-Id: <36CABFA8.7D1233DA@datenrevision.de>
Tad McClellan wrote:
>
> 23_skidoo (23_skidoo@geocities.com) wrote:
> : bill@microsoft.com You are the antichrist!
>
> Atta boy, 23.
Actually, billg@microsoft.com .
HTH, HAND
Cheers,
Philip
------------------------------
Date: Wed, 17 Feb 1999 16:33:57 +0700
From: "etandean" <etandean@geocities.com>
Subject: Help - Perl Binaries for old SCO UNIX rel 3.2v4
Message-Id: <7ae3h0$quv@news1.rad.net.id>
Dear All,
Is there somebody who could help tell me
where I could download PERL (in BINARY) for SCO UNIX rel 3.2v4.
And how could I install it ?
Really appreciate any help. Thank you.
E Tandean
etandean@geocities.com
------------------------------
Date: 17 Feb 1999 08:52:37 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Help - Perl Binaries for old SCO UNIX rel 3.2v4
Message-Id: <7aehj5$hb9$1@panix.com>
In <7ae3h0$quv@news1.rad.net.id> "etandean" <etandean@geocities.com> writes:
>Is there somebody who could help tell me
>where I could download PERL (in BINARY) for SCO UNIX rel 3.2v4.
In the `binaries' section of Perl Reference there is a link to binarie
distributions of Perl for SCO.
Perl Reference
http://reference.perl.com
>And how could I install it ?
Follow the instructions. :)
--
Clay Irving
clay@panix.com
------------------------------
Date: 17 Feb 1999 12:26:36 GMT
From: bababozorg@aol.com (Bababozorg)
Subject: Help,,, (Apache server)
Message-Id: <19990217072636.18614.00002874@ng04.aol.com>
hi
i installed apache web server in my comp but i cant make it read the cgi or
perl scripts it just give me 500 Internal Server Error every time i run the
scripts.
i think i have to write the address or perl.exe somewhere but i dont know where
to write that
can you help me please
thanks
hamed
------------------------------
Date: Wed, 17 Feb 1999 08:34:07 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Help,,, (Apache server)
Message-Id: <7aeg4a$opt$1@camel0.mindspring.com>
Bababozorg wrote in message <19990217072636.18614.00002874@ng04.aol.com>...
:hi
:i installed apache web server in my comp but i cant make it read the cgi or
:perl scripts it just give me 500 Internal Server Error every time i run the
:scripts.
:i think i have to write the address or perl.exe somewhere but i dont know
where
You need to configure Apache in order implement CGI. Check out the
appropriate server newsgroups and/or search DejaNews.
You might try:
comp.infosystems.www.servers.ms-windows
comp.infosystems.www.servers.unix
HTH
AmD
------------------------------
Date: Tue, 16 Feb 1999 22:08:55 +0000
From: Webmaster@KILL-MEquorndon-mag.org.uk (Simon Roulstone)
Subject: Re: Help,Perl Script doesn't work!
Message-Id: <Webmaster-1602992208550001@whaserv.demon.co.uk>
Thanks for that,
Do I take it `perldoc -f binmode` is a bit of code I should insert into my
script somewhere?, like I said I'm very new at all this stuff.
I also found out that the server is running the following if its any help.
WinNT4, Perl 5.(something), IIS Web Server (latest version with
Options Pack for NT).
Thanks
Simon.
--
Simon Roulstone
Webmaster@KILL-MEquorndon-mag.org.uk
http://www.quorndon-mag.org.uk/
Remove KILL-ME from email address when replying by
email, Thankyou.
------------------------------
Date: 17 Feb 99 12:59:04 GMT
From: "Bob Flanagan" <no@not.net>
Subject: Re: How do you copy a text file to the body of an e-mail note?
Message-Id: <01be8734$6d02c5e0$6c5bb7cc@flanagrwhome>
Chris, many thanks for the solution. I'll try it this evening.
As to why shell to a mail program - my knowledge level of perl and all
related things is about a 1 on a scale of 1 to 1,000 <g>. Also, at this
stage this is just for a reply when a user signs up for a mailing list. By
the way, if you do contract programing, I suspect that I'll have some work
for you. I can be contacted at bob@add-ins.com for offline discussion.
Bob Flanagan
Chris Morrow <morrowc@his.com> wrote in article
<36CA58E7.80D6A2A6@his.com>...
> Bob,
> Why shell out to a mail program? Why not use the nifty Net::SMTP module?
> (in Libnet I believe)
>
> There is a great example of creating a message in the documentation, so
> I'll forgo putting one in here.
>
> Caution: for some reason, the perl Net::SMTP seems to be able to sendout
> messages faster then some MTA's can handle them... if you have to send
> out many messages try a 1 second sleep or something between messages. I
> killed a remote mailhost this way one day :(
>
> -Chris
>
> Bob Flanagan wrote:
> >
> > I have a text file called reginfo.txt and want to copy it to the body
of a
> > e-mail note and mail it. I haven't been able to get this to work. I
can
> > sometimes get a single line to be sent, but no more. The following is
the
> > code that I am using:
> >
> > sub mailadd{
> > open(TXT,"reginfo.txt");
> > my $body = <TXT>;
> > close(TXT);
> >
> > open (MAIL, "|$mailprog $in{'address'}") || die "Can't open
> > $mailprog!\n";
> > print MAIL "From: $admin_email\n";
> > print MAIL "Subject: The Office Sentinel Mailing List\n";
> > print MAIL "$body\n";
> > close (MAIL);
> > }
> >
> > I'm uploading both the txt file and the cgi using WS FPS if that makes
any
> > different. The txt file was created using an ascii editor (kedit).
> >
> > Any help would be appreciated.
> >
> > Bob Flanagan
>
------------------------------
Date: 17 Feb 1999 13:06:53 GMT
From: ran@netgate.net
Subject: Re: Perl evangelism
Message-Id: <7aeetd$gi5$1@remarQ.com>
In <comdog-ya02408000R1602992002590001@news.panix.com>, comdog@computerdog.com (brian d foy) writes:
>it's almost depressing to think that someone might actually
>beleive this. Programmers, not languages, write obfuscated code;
But they don't do much of it in VB(script), which, because it lacks
some of the syntactic elements needed to do world-class obfuscation, is
only slightly easier than COBOL to make cryptic.
>and
>Perl certainly didn't invent the concept.
And Bonnie and Clyde certainly didn't invent submachine guns. But they
had them, and were able to do a lot more harm than they could have with
sharpened sticks.
In an era when more unseasoned programmers than previously existed in
all of history are running around trying to rapidly deploy
semi-real-time applications that can do major damage to their employers
if they screw up, the urging of a little extra vigilance in the use of
a tool that was originally designed expressly for hacking, not
engineering, is hardly unfair or unreasonable.
Anybody who's ever had to put in a string of 20-hour days tracking down
an obscure bug in some rookie's spaghetti assembler or "optimized" APL
can tell you that failing to exercise that caution is just plain
braindead.
>more mis-informed crap from an MS marketing droid posing as
>a technology consultant.
Not much of a "pose": a MicoSloth product manager, clearly identified
as such in the byline, on an MS-owned website, who flat-out states in
his opening paragraph that he's trying to push MS's own products against
a tide of industry preference for the alternatives. What did you want?
A "<blink>I work for Bill</blink>" before every paragraph?
Ran
------------------------------
Date: Wed, 17 Feb 1999 14:42:28 +0200
From: "Ian Coetzee" <seccoza@mweb.co.za>
Subject: Perl for Windows interface ?
Message-Id: <36cab9ed.0@news1.mweb.co.za>
Hi
I am developing a Perl for Windows debugger and wonderred if anybody knew
how to capture the output of the Perl (command line interpreter) ?
This project will be released as freeware .
Ian Coetzee
email: seccoza@mweb.co.za
------------------------------
Date: Wed, 17 Feb 1999 08:58:24 GMT
From: schoedema@my-dejanews.com
Subject: Problem with oraperl in a web-browser
Message-Id: <7ae0bc$hdc$1@nnrp1.dejanews.com>
I have the following configuration:
Solaris 2.5, Apache 1.2.5, Netscape 4.04 under Solaris.
I have a Perl script, that connects to an oracle-DB via CGI and Oraperl from a
browser (IE4 or Netscape 4). Under Oracle V.7.3.2 everything works fine.
After upgrading the DB to V.7.3.4 the script didn't work properly anymore. The
Apache error-log produces the follwing message:
---------- install_driver(Oracle) failed: Can't load
'/usr/local/lib/perl5/site_perl/sun4- solaris/auto/DBD/Oracle/Oracle.so' for
module DBD::Oracle: ld.so.1: /usr/local/bin/perl: fatal: libclntsh.so.1.0:
can't open file: errno=2 at
/usr/local/lib/perl5/sun4-solaris/5.00403/DynaLoader.pm line 155.
at (eval 1) line 2
DBI::install_driver('DBI', 'Oracle') called at
/usr/local/lib/perl5/site_perl/Oraperl.pm line 57 require Oraperl.pm called
at /usr/local/www/cgi-bin/digidat/list_msanl line 21 main::BEGIN() called at
/usr/local/lib/perl5/site_perl/Oraperl.pm line 0 eval {...} called at
/usr/local/lib/perl5/site_perl/Oraperl.pm line 0 BEGIN failed--compilation
aborted at /usr/local/www/cgi-bin/digidat/list_msanl line 21. -----------
If I create a softlink from the old oraclehome to new oraclehome the script
is running without a problem even from the webbrowser. Obviously there seems
to be a problem with the path-tracking within the Apache server.
I'm grateful for any suggestions concerning my problem.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 17 Feb 1999 09:09:48 GMT
From: nospam5@yahoo.com
Subject: regex: closest occurrence of two words?
Message-Id: <7ae10o$hru$1@nnrp1.dejanews.com>
I am learning perl, and cannot understand if I'm missing sth or if there's
indeed no way to search "backwards". Consider this text:
"c d A e f A g h B i j"
I know in advance that 'B' will occur just once. I am looking for an
occurrence of 'A' that is closest to 'B'.
I thought for a moment /A.*?B/ would work, as *? is supposed to match the
fewest chars. But then I read that it's the fewest "given a particular
starting location" (and I understand that, considering the amount of possible
matches there may be, it's impossible to compare them all). So it will match
the same as regular *.
Now, if I could ask perl to work its matching process *backwards*, using the
reversed string and the reversed (in some sense) expression, it would do just
what I want (using the lazy *?). Is there a way to do it?
Of course, I could instead look for /A[^A]*B/, but it's not going to work if A
and B are very complex themselves (or at least it's going to be more
complicated than just giving a modifier "search backwards").
It seems that it'd be nice to do even more: to direct Perl to use a certain
order in which to go around the regular expression doing the matching. Does it
make sense?
Thanks,
Max
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 17 Feb 1999 09:31:54 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: regex: closest occurrence of two words?
Message-Id: <slrn7cl34a.t33.sholden@pgrad.cs.usyd.edu.au>
On Wed, 17 Feb 1999 09:09:48 GMT, nospam5@yahoo.com <nospam5@yahoo.com> wrote:
>Now, if I could ask perl to work its matching process *backwards*, using the
>reversed string and the reversed (in some sense) expression, it would do just
>what I want (using the lazy *?). Is there a way to do it?
reverse the string and then do the regex. If you don't know how to reverse
a string then look up the pretty obviously function in perlfunc.
>
--
Sam
So I did some research. On the Web, of course. Big mistake...
--Larry Wall
------------------------------
Date: Wed, 17 Feb 1999 14:06:03 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Regular expression for Currency ???
Message-Id: <36CABEBB.D7091CAF@datenrevision.de>
John Warner wrote:
>
> @nums=m<\-?\$\d{1,3}(?:\,?\d{3})*(?:\.?\d{0,2}?)?(?!\d)\s*[million|thousand|m|k]*>gi;
^^^^^^^^^^^^^^^^^^^^^^^
ITYM (million|thousand|m|k)* or (?:million|thousand|m|k)
not [million|thousand|m|k]*
(If I'm not mistaken, the thing you wrote is the same as [milonthusadk|]
-- a character class matching 0 or more of any of the inside, even
"thousillion" etc.)
Cheers,
Philip
------------------------------
Date: Wed, 17 Feb 1999 00:07:20 -0800
From: Austin Schutz <spamsux-tex@habit.com>
To: John Diener <diener@darwin.ucsc.edu>
Subject: Re: reverse ?
Message-Id: <36CA78B8.68CF@habit.com>
John Diener wrote:
>
> i am a very novice perl user , and am writing a simple script to take a
> dna sequence 5'-ATCG-3'
> and spit out its compliment (which is 3'-TACG-5') however i want the
> compliment to read 5' to 3' too. so after i read the seq into my hash
> andspit it out i want to 'reverse' it. for some reason the reverse
> command is not working. i am using perl 5.04 and i have tried to
> impliment the same simple example to reverse an array that in all 3 of
> my manuals. i could not find anything in our perl man page on 'reverse'
> either. i hop e i am not being too dense. any help would be very
> appreciated.
>
> thanks,
> john
# As with everything except playing dead, there's more than one way
# to do it.
# First thing to do would be to try to remove the stuff at both ends
# so only the stuff you want to reverse is left.
$original_string = "5'-ATCG-3'";
# I'm doing this in a couple steps here to make it clear.
# Match an integer at the beginning of the string followed by a tick.
# remove them from the string. By putting the parentheses around it
# you save the value in a variable, $1.
$original_string =~ s/^(\d+\')//;
$beginning_part = $1;
# and remove the part at the end.
$original_string =~ s/(\d+\')$//;
$end_part = $1;
# Now $original_string should be "-ATCG-". Now we use split.
@parts_to_reverse = split('',$original_string);
while (@parts_to_reverse) { # While there are letters left...
# Take the letter at the end of the string and append them
# to the new string.
$new_string .= pop(@parts_to_reverse);
}
# Now put the final result together.
$final_string =$beginning_part.$new_string.$end_part;
# Check our work.
print "Final string:$final_string:\n";
# Prints out Final string:5'-GCTA-3': for me. Which is what you asked
# for but not what you said it would be.
# I would recommend reading http://www.perl.org/perl.html
# for recommended reading. This stuff is cake with a little practice.
# Austin
------------------------------
Date: Wed, 17 Feb 1999 10:14:20 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: reverse ?
Message-Id: <36d0933b.5759051@news.skynet.be>
John Diener wrote:
>i am a very novice perl user , and am writing a simple script to take a
>dna sequence 5'-ATCG-3' and spit out its compliment (which is
>3'-TACG-5') however i want the compliment to read 5' to 3' too. so
>after i read the seq into my hash and spit it out i want to 'reverse'
>it.
> i hope i am not being too dense.
Yes you are. I fail to see how 3'-TACG-5' is the complement to
5'-ATCG-3'. 3 and 5 switched, "TA" turned into "AT", but "CG" is
untouched?
If your could give the rules for all results you expect, plus a complete
example, that might help me (er... "us") to turn this into code.
Bart.
------------------------------
Date: Wed, 17 Feb 1999 08:02:47 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: reverse ?
Message-Id: <7aee9i$js9$1@camel0.mindspring.com>
John Diener wrote in message <36CA0EBC.1E6BE6F3@darwin.ucsc.edu>...
:i am a very novice perl user , and am writing a simple script to take a
:dna sequence 5'-ATCG-3'
:and spit out its compliment (which is 3'-TACG-5') however i want the
:compliment to read 5' to 3' too. so after i read the seq into my hash
:andspit it out i want to 'reverse' it. for some reason the reverse
:command is not working. i am using perl 5.04 and i have tried to
:impliment the same simple example to reverse an array that in all 3 of
:my manuals. i could not find anything in our perl man page on 'reverse'
:either. i hop e i am not being too dense. any help would be very
:appreciated.
:
:thanks,
:john
Well, if you posted your code we could probably be more helpful. Anyway,
assuming you want 3'-TAGC-5' (slightly different than what you asked for)
here is a quick way:
my $dna = q(5'-ATCG-3');
my ($fir,$sec,$thir) = split(/-/,$dna);
my $revdna = "$thir-".reverse($sec)."-$fir";
and just for fun
my $revdna2 = join('-',reverse(map{my $keep = /\d/ ? $_:
reverse}split(/-/,$dna)));
HTH
AmD
------------------------------
Date: Wed, 17 Feb 1999 07:29:22 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Server Software
Message-Id: <i7gea7.ol8.ln@magna.metronet.com>
Bababozorg (bababozorg@aol.com) wrote:
: i need a server software which supports .cgi/.pl files and .htaccess files
: at the moments i use OmniHTTPd server but it doesnt sopport .htaccess
: or i dont know how to do it.
You have found the wrong newsgroup.
We discuss Perl here.
Your post has nothing about Perl in it.
: can you help please
You will get better responses about HTTP servers in a newsgroup
that is in some way connected to WWW type stuff:
comp.infosystems.www.authoring.cgi
comp.infosystems.www.servers.mac
comp.infosystems.www.servers.misc
comp.infosystems.www.servers.ms-windows
comp.infosystems.www.servers.unix
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 17 Feb 1999 11:14:49 GMT
From: pvdkamer@inter.NL.net
Subject: Speed Up Perl
Message-Id: <36caa3c2.10005684@news.wxs.nl>
Does anyone have a sulution to speed up perl scripts ?
i've got several perl scripts wich are all comparing substrings in 2
textfiles.
Perl running on Linux is better performing and Perl running on Win32
(win98) is not performing at all.
Does anyone have a solution to speed up perl script mayby by compiling
them or something else ?
Thanks..
Paul
------------------------------
Date: Wed, 17 Feb 1999 10:40:24 +0100
From: Stefan Etschberger <ste@hl.siemens.de>
Subject: STDERR of system call in variable?
Message-Id: <36CA8E88.A05FADAF@hl.siemens.de>
I've got a system call of a UNIX program in a perl script. How do i
redirect the STDERR output of this program to a perl variable?
-Stefan
Stefan.etschberger@hl.siemens.de
------------------------------
Date: Wed, 17 Feb 1999 12:47:51 -0000
From: "Mike Rogers" <mdr@server1.smb.man.ac.uk>
Subject: Tk causes perlglob windows in NT
Message-Id: <7aedc5$n92$1@yama.mcc.ac.uk>
Hi everybody
I am calling perl scripts from a Tcl/Tk frontend interface. This works
well on Unix/Linux, but on NT Win95 and Win98 my screen becomes
filled with command windows with the title perlglob or perl.
Does anyone know how to get around this disconcerting side-effect.
Many thanks
Mike
----------------------------------------------------------------------------
Mike Rogers
University of Manchester
Wolfson Image Analysis Unit email: mdr@server1.smb.man.ac.uk
School of Medicine www:
http://www.wigan-warriors.com
Division of Image Science and Biomedical Engineering
Stopford Building
Oxford Road
Manchester
M13 9PT
United Kingdom
------------------------------
Date: Wed, 17 Feb 1999 13:49:23 GMT
From: "Bob Laflamme" <rlaflamm@sscinc.com>
Subject: Web Browser Setup
Message-Id: <DNzy2.3388$rs2.4186327@client.news.psi.net>
I have some perl scripts which run on NT IIS. When I access the url from
Internet Explorer 4.x, everything works fine. However, when using Netscape
or older versions of IE, the user gets prompted with the "Save As" dialog.
I aruge that the problem is with the web client, others say the server is
the issue. I don't agree because it works with some clients and jnot others.
Are there settings in the browser that need to change?
The url is something like: /www.myinternet.com/cgi-bin/dosomething.pl
Thank you in advance,
bob laflamme
rlaflamm@sscinc.com
------------------------------
Date: 17 Feb 1999 12:29:29 GMT
From: bababozorg@aol.com (Bababozorg)
Subject: Re: WWW Hosting for a site in need of CGI
Message-Id: <19990217072929.18614.00002875@ng04.aol.com>
try this:
http://www.advantage2you.com/
------------------------------
Date: Wed, 17 Feb 1999 07:39:29 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: y2k problems with perl
Message-Id: <hqgea7.ol8.ln@magna.metronet.com>
Ravindran_Abhilash (Abhilash.Ravindran@compaq.com) wrote:
: Functions gmtime and localtime seems to have problems with year >= 2000.
^^^^ ^^^^^^ ^^^^^^^^^
perldoc -f gmtime
perldoc -f localtime
: For example the time corresponding to year 2000, the year is returned as
: 100 instead of 00.
: Does anybody have more information on this?
Anybody that can read does.
Can you do that?
Perl FAQ, part 4,
"Does Perl have a year 2000 problem? Is Perl Y2K compliant?"
Also, the description of both of those functions indicate that
there is _no_ ambiguity in the value they return for the year.
Any year value from these functions corresponds to exactly
one year. So no problem with these functions (which is not to
say that there is no problem with how programmers _use_ those
functions, because some of them can't read either).
Also also, a search of c.l.p.misc on www.dejanews.com for "y2k"
(taken from your very own Subject: header) finds "about 1000"
hits.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4913
**************************************