[18288] in Perl-Users-Digest
Perl-Users Digest, Issue: 456 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 9 18:06:15 2001
Date: Fri, 9 Mar 2001 15:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984179112-v10-i456@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 9 Mar 2001 Volume: 10 Number: 456
Today's topics:
(OFF TOPIC - IGNORE) Re: Hidden URL <godzilla@stomp.stomp.tokyo>
Re: (OFF TOPIC - IGNORE) Re: Hidden URL <mischief@velma.motion.net>
Accessing WinNT clipboard form Perl <laza@cs.ubc.ca>
Re: Accessing WinNT clipboard form Perl <Jonathan.L.Ericson@jpl.nasa.gov>
Re: Can 2 Form actions be executed with one Submit butt <graham@wellho.net>
Re: CGI won't work in Netscape browser <brondsem@my-deja.com>
Re: FAQ 6.11: Can I use Perl regular expressions to m <mischief@velma.motion.net>
Re: Help to Install Perl <webmaster@webdragon.munge.net>
Help! Newbie question brichards@cda.com
Re: Help! Newbie question <Jonathan.L.Ericson@jpl.nasa.gov>
Re: Help! Newbie question <mischief@velma.motion.net>
Re: Hidden URL (Glyndwr)
Re: How do I combine filehandles, refs and strict? (Charles DeRykus)
Re: How to get perl not to convert decimal character <dersgniw@fuse.net>
Macbeth and Perl threads <vdhamer@msn.com>
Re: Newbies welcome <kettle_drum@yahoo.com>
Re: Newbies welcome <darrenls21@yahoo.com>
Re: number of characters (length) <graham@wellho.net>
Re: number <mischief@velma.motion.net>
Re: Perl & Recursion : Why doesn't this work? <webmaster@webdragon.munge.net>
perl code/module to create a dynamic tree TOC menu ?? <abcd@ntlworld.com>
Perl won't let go of a file open for READ. <mflaherty2@earthlink.net>
Re: Perl won't let go of a file open for READ. <bart.lateur@skynet.be>
perl5db.pl question ()
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 09 Mar 2001 11:38:03 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: (OFF TOPIC - IGNORE) Re: Hidden URL
Message-Id: <3AA9311B.8388E2D6@stomp.stomp.tokyo>
Miguel Cruz wrote:
(snippage not noted by Cruz - context not retained)
> Godzilla! wrote:
> > Should you someday be involved with an internet conversation
> > and find it contextually appropriate to post a link to the
> > national headquarters of the Ku Klux Klan, would you be willing
> > to endorse and defend your link to avoid appearing to be a
> > true hypocrite per your personal rules just stated?
> Just to make sure our analogy is on track....
It is not "our" analogy. It is my analogy. I do understand
your deep admiration of my talent with words. However, I will
not tolerate your attempts to take credit for my words. This
is plagiarism on your part.
> let's make sure we understand....
It is inappropriate of you to speak for myself. It is
quite impossible for you to read my mind and know my
thoughts. Speak for yourself only, lest you present an
appearance of being significantly ignorant. I do hope
you are capable of understanding this simple notion.
> that the aforementioned hypothetical posting of KKK HQ address
> was in response to someone's question, "I'm going to be in
> Birmingham for a couple days next week. Can you suggest a nice
> place to stop in and find some company?"
I do not recall reading this quoted question of yours.
Perhaps you read this elsewhere and mistakenly believe
you read this question within this newsgroup.
My preference would be to spend my leisure time at an
eloquent Bed & Breakfast in Aspen, Colorado, preferably
conveniently close to Aspen's snow ski resorts.
Regardless of your ethnic heritage, I would not suggest
a person with your surname entertain a notion of visiting
with the Ku Klux Klan, for pleasure. More accurately,
I wouldn't suggest anyone visit with the Ku Klux Klan
with an intent of enjoyment.
Incidently, the Ku Klux Klan national headquarters are
located in classic Middle American predominantly Anglo,
Butler, Indiana. Nonetheless, Birmingham, Alabama, is
a very warm and friendly city worth visiting.
Godzilla!
------------------------------
Date: Fri, 09 Mar 2001 21:34:14 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: (OFF TOPIC - IGNORE) Re: Hidden URL
Message-Id: <taij2msbt9lide@corp.supernews.com>
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Miguel Cruz wrote:
> (snippage not noted by Cruz - context not retained)
>
>> Godzilla! wrote:
> Regardless of your ethnic heritage, I would not suggest
> a person with your surname entertain a notion of visiting
> with the Ku Klux Klan, for pleasure. More accurately,
> I wouldn't suggest anyone visit with the Ku Klux Klan
> with an intent of enjoyment.
I would thoroughly enjoy visting the KKK headquarters
for the express purpose of serving one of its members
a court summons and/or arrest warrant.
What can I say -- my only predjudice is against bigots.
;-)
BTW, I am from middle America and am predominantly
Anglo.
What has this to do with Perl, except that Godwin
might write code in Perl?
A reference to a site should be qualified by the author
to avoid confusion with an endoresment, even if it is
unfair to assume endorsement by the reader. It is, after
all, the author's responsibility to relay the information
to the reader.
Chris
--
Christopher E. Stith
Even in the worst of times, there is always someone who's
never had it better. Even in the best of times, there is
always someone who's never had it worse.
------------------------------
Date: Fri, 09 Mar 2001 11:27:33 -0800
From: Marius Laza <laza@cs.ubc.ca>
Subject: Accessing WinNT clipboard form Perl
Message-Id: <3AA92EA5.1238B5DA@cs.ubc.ca>
Hi,
Is there a way to access the clipboard form Perl under MSWindows? I am
using WIndows2000, but I believe the solution should be the same on any
Win32 version.
What I want to achieve is retrieve the contents of the clipboard as
plain text, do some regexp substitution, and put it back onto the
clipboard.
Thanks
Marius Laza
------------------------------
Date: 09 Mar 2001 21:14:48 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Accessing WinNT clipboard form Perl
Message-Id: <867l1y8x13.fsf@jon_ericson.jpl.nasa.gov>
Marius Laza <laza@cs.ubc.ca> writes:
> Is there a way to access the clipboard form Perl under MSWindows? I am
> using WIndows2000, but I believe the solution should be the same on any
> Win32 version.
>
> What I want to achieve is retrieve the contents of the clipboard as
> plain text, do some regexp substitution, and put it back onto the
> clipboard.
Have you used search.cpan.org? I found one that allows just what you
are asking.
Jon
------------------------------
Date: Fri, 09 Mar 2001 19:34:08 +0000
From: Graham Ellis <graham@wellho.net>
Subject: Re: Can 2 Form actions be executed with one Submit button?
Message-Id: <3AA93030.379FBF32@wellho.net>
Just combine the code to email the data entries AND the code to print
the thank you page into the same script .... one of the features of
a programming language such as Perl, after all, is that you can perform
a sequence of operations one after another! Might be a good idea to
use subroutines so that if there's any need to split the code in the
future you can do so. See also, "use", modules, etc ...
Graham
--
Graham Ellis, Well House Consultants
Melksham, Wiltshire, UK
http://www.wellho.net graham@wellho.net
Paul wrote:
>
> Thanks for the response, Jon. I was actually making a script.
>
> I just needed the script to perform 2 functions - to mail the data and
> at the same time display a response page, when the <INPUT TYPE=submit
> Value=Send> was clicked.
>
> The script currently displays all entered from a form and then hidden
> files are also generated. In the same page, there is a SUBMIT button
> where the customer can review the data. If one of the entries are
> incorrect, they can go back and correct it. Once all the entries are
> correct, the SUBMIT button is clicked and I want it to do 2 things:
>
> 1) mail the data entries
> 2) Print a thank you page.
>
> I've tried each one separately and they both work (separately). I really
> wanted the script to perform both functions when the SUBMIT button is
> clicked.
>
> Hope anyone can help.
>
> Thanks,
> FORM Rookie
--
------------------------------
Date: Fri, 09 Mar 2001 21:22:57 GMT
From: "Dave Brondsema" <brondsem@my-deja.com>
Subject: Re: CGI won't work in Netscape browser
Message-Id: <RQbq6.42530$W05.8344284@news1.rdc1.mi.home.com>
"Richard" <rworth5@home.com> wrote in message
news:TH8q6.111$rB2.22780@news1.rdc1.mb.home.com...
> I have quite a few scripts running online and today noticed they are not
> executing when i try and run them from Netscape browser.
>
> When executed, all I get is the HTML code that is processed from the
script.
> I have no idea what is going on.
> Everything works great in any other browser. Mainly the reason why I think
> Netscape is a heap of crap. But I must please everyone, and cannot do this
> if Netscape doesnt like my scripts.
>
> Can anyone explain why this is happening.
>
> Thank You,
> Richard
>
>
You said that HTML code shows up, so that means your code does execute.
Otherwise you would see code.
If it is just that your HTML isn't rendered correctly, make sure you print
the proper headers.
Post some of your code so we can help you, we can't read your mind
(correctly).
Dave Brondsema
------------------------------
Date: Fri, 09 Mar 2001 19:28:41 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: FAQ 6.11: Can I use Perl regular expressions to match balanced text?
Message-Id: <taibn948ul9r47@corp.supernews.com>
PerlFAQ Server <faq@denver.pm.org> wrote:
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with every Standard Distribution of
> Perl.
> +
> Can I use Perl regular expressions to match balanced text?
There are many ways to do it without REs.
> Although Perl regular expressions are more powerful than "mathematical"
> regular expressions, because they feature conveniences like
> backreferences (`\1' and its ilk), they still aren't powerful enough --
> with the possible exception of bizarre and experimental features in the
> development-track releases of Perl. You still need to use non-regex
> techniques to parse balanced text, such as the text enclosed between
> matching parentheses or braces, for example.
> An elaborate subroutine (for 7-bit ASCII only) to pull out balanced and
> possibly nested single chars, like ``' and `'', `{' and `}', or `(' and
> `)' can be found in
> http://www.perl.com/CPAN/authors/id/TOMC/scripts/pull_quotes.gz .
> The C::Scan module from CPAN contains such subs for internal usage, but
> they are undocumented.
Text::CSV, Text::CSV_XS, Text::DelimMatch, and Text::Balanced, available
on CPAN, may also be of interest.
Chris
--
Christopher E. Stith
Programming is a tool. A tool is neither good nor evil. It is
the user who determines how it is used and to what ends.
------------------------------
Date: 9 Mar 2001 19:42:03 GMT
From: "Scott R. Godin" <webmaster@webdragon.munge.net>
Subject: Re: Help to Install Perl
Message-Id: <98bbmb$h2n$0@216.155.32.55>
In article <2R1q6.163687$B6.36693885@news1.rdc1.md.home.com>, "Suzanne"
<sbucciarelli1@home.com> wrote:
| Perhaps you are a shut-in ... I am not. I have an account from
| work, from AOL, from Mindspring and cable .... tsk tsk tsk .....
| crime of the century
You do realize it's just as easy if not easier for us to press the "next
post" key as it is to dump someone in the killfile, and simply not
bother responding to you at all..
following up 'normally' is not at all difficult. I'm frankly rather
surprised at your obtuseness. In any case, no water off my back.
post->next();
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: 9 Mar 2001 19:05:32 GMT
From: brichards@cda.com
Subject: Help! Newbie question
Message-Id: <98b9hs$7ih$1@news.netmar.com>
I am struggling to take my first step. I have been given the task to create
Web Services. It seems using SOAP and Perl on Unix/Lynx would be the best
option. My problem is I am a Microsoft guy. (don't hold this against me) I
have installed Perl and Apache on a Red Hat Lynx box. I have created a
simple Perl script that ran. I installed the files from Paul Kulchenko's
excellent doc "Quick Start with Soap." My Perl client works connecting
to
soaplite.com. Now I am trying to setup my Lynx box. Where do I put the
hibye.cgi file and where do I put the Demo.pm file?
Thank you in advance for your help.
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net
------------------------------
Date: 09 Mar 2001 21:09:56 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Help! Newbie question
Message-Id: <86bsra8x97.fsf@jon_ericson.jpl.nasa.gov>
brichards@cda.com writes:
> I am struggling to take my first step. I have been given the task to create
> Web Services. It seems using SOAP and Perl on Unix/Lynx would be the best
> option. My problem is I am a Microsoft guy. (don't hold this against me) I
> have installed Perl and Apache on a Red Hat Lynx box. I have created a
> simple Perl script that ran. I installed the files from Paul Kulchenko's
> excellent doc "Quick Start with Soap." My Perl client works connecting
> to
> soaplite.com. Now I am trying to setup my Lynx box. Where do I put the
> hibye.cgi file and where do I put the Demo.pm file?
I assume you mean Linux? The answer to your question depends on how
you Apache server is configured, which means it isn't really a perl
question. Please read the Apache documentation.
Jon
------------------------------
Date: Fri, 09 Mar 2001 22:56:31 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Help! Newbie question
Message-Id: <tainsvf9l2l12b@corp.supernews.com>
brichards@cda.com wrote:
> I am struggling to take my first step. I have been given the
> task to create Web Services. It seems using SOAP and Perl on
> Unix/Lynx would be the best option. My problem is I am a
While there is an OS called LynxOS, I imagine you mean Linux.
> Microsoft guy. (don't hold this against me) I have installed
> Perl and Apache on a Red Hat Lynx box. I have created a
Yep, you do mean Linux. LynxOS is soemthing else. The lynx
web browser you may have available on Linux is something else
again.
> simple Perl script that ran. I installed the files from Paul
> Kulchenko's excellent doc "Quick Start with Soap." My Perl
> client works connecting to soaplite.com. Now I am trying to
Congratulations.
> setup my Lynx box. Where do I put the hibye.cgi file and
In the directory desginated as the ScriptAlias directory for
the particular site in your Apache configuration file (which,
under stock RedHat, is /etc/httpd/conf/httpd.conf).
> where do I put the Demo.pm file?
This depends. If you want it available to all your Perl
programs, you put it somewhere in one of the directories
listed in the @INC variable. For one of my perls, which is
5.005_03 stock with RedHat 6.2, that includes the following:
/usr/lib/perl5/5.00503/i386-linux
/usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005
.
The last item there, q{.}, means the current directory of the
Perl program. I would suggest that if you want just a couple
of program to need it, you put it in their respective directories.
If, on the other hand, you plan to write a bunch of programs
which use your module, I'd put it in /usr/lib/perl5/site_perl/5.005
since that is intended for modules and libraries particular to
your machine.
> Thank you in advance for your help.
You're welcome. I hope is does help.
Chris
--
Christopher E. Stith
If they can get you asking the wrong questions, they don't
have to worry about the answers.
-- Thomas Pynchon, Gravity's Rainbow
------------------------------
Date: Fri, 09 Mar 2001 19:53:57 GMT
From: glynFOOdwr@FSCKdeleteEmeD.co.uk (Glyndwr)
Subject: Re: Hidden URL
Message-Id: <slrn9aid72.19d.glynFOOdwr@glyndwr.dyndns.org>
On Fri, 09 Mar 2001 10:24:30 -0800, Godzilla! scribbled:
I know I shouldn't feed trolls, and I know I shouldn't stoop like this,
but here goes anyway: (WARNING: offensive langauge)
>Randal L. Schwartz wrote:
>
>(lots of snippage)
>
>> See the difference? Surely someone of your superior
>> knowledge and breeding understands context.
>
>Absolutely. I am certain you need a tampon
>along with a Midol or two previously suggested.
You really are spectacularly shit, aren't you?
--
-=G=-
Web: http://www.fscked.co.uk ICQ: 66545073
------------------------------
Date: Fri, 9 Mar 2001 20:57:39 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: How do I combine filehandles, refs and strict?
Message-Id: <G9y7K4.H6K@news.boeing.com>
In article <3AA67DF9.5D74CAC1@statoil.com>,
Svein Tore Opdal <stop@statoil.com> wrote:
>hi, I am trying to adapt (more or less duplicate) the code found on the
>'perl.com' website:
>http://www.perl.com/pub/doc/manual/html/pod/perlfunc/open.html
>...
>perl error message is
>Can't use string ("fh01") as a symbol ref while "strict refs" in use at
>.//testOpen.pl line 15.
Untested but using Symbol to generate filehandles should work:
>..
>use strict ; # this does not work
use Symbol;
>my $file;
>foreach $file (@ARGV) {
> # process($file, 'fh00');
process($file);
>}
>
>sub process {
> # my ($filename, $input) = @_;
my $filename = shift;
> # $input++; # this is a string increment
my $input = Symbol::gensym;
> ...
> local $_;
> while (<$input>) { # note use of indirection
> if (/^ "(.*)"/) {
> # process($1, $input);
process($1);
> next;
> }
> #... # whatever
> }
>}
>
hth,
--
Charles DeRykus
------------------------------
Date: Fri, 9 Mar 2001 15:44:22 -0500
From: "Brian" <dersgniw@fuse.net>
Subject: Re: How to get perl not to convert decimal character
Message-Id: <taig5dlbff4l84@corp.supernews.com>
CGI doesn't help. The problem is I'm sending across a variable of variables
concatenated with |. And once these are passed, obviously, splitting
doesn't work because there could have been a pipe in a variable that I put
into the concatenated variable.
My solution was to use a non-used character. I used hex character AB to
join and split the variables.
Regards,
Brian
"Chris Stith" <mischief@velma.motion.net> wrote in message
news:tafi09ehh64g11@corp.supernews.com...
> Brian <dersgniw@fuse.net> wrote:
> > I'm trying to write a CGI program that is passing around a list of |
(pipe)
> > separated values.
>
> > ie - a|b|c
>
> > The problem is these values can contain pipes. Perl (or the webserver?)
> > converts the "|" to "%7C" when passed. I figured I could modify the
input
>
> [...]
>
> > Any ideas would be apprecated.
>
> Here's my idea:
>
> use CGI;
>
> The CGI or CGI::Lite modules will give you strings that are decoded
> properly when you grab the forma data using them, and will encode
> them properly when you get ready to send them back to the browser.
>
> Chris
>
> --
> Christopher E. Stith
> The purpose of a language is not to help you learn the
> language, but to help you learn other things by using the
> language. --Larry Wall, The Culture of Perl, August 1997
>
------------------------------
Date: Fri, 9 Mar 2001 23:40:51 +0100
From: "Peter van den Hamer" <vdhamer@msn.com>
Subject: Macbeth and Perl threads
Message-Id: <98bm3i$c8n$1@news.IAEhv.nl>
Question: is it possible for one Perl (5.005-type) thread to kill
another thread in that thread's sleep?
In other words: can my main thread kill one of the other
threads without waiting for a sleep(60) to complete?
Alternative I have to break this down into an ugly loop
around sleep(1) which checks my termination condition
once a second instead of once a minute.
Context: what I am trying to do is write a multi-threaded
ping program which creates New threads for each site
to be pinged. The results are written to a log file of the
following format:
[stuff deleted - best viewed in a fixed width font]
.|..v 08-Mar-01 23:52:18 yahoo became INaccessible after 429 seconds
.|..^ 08-Mar-01 23:52:23 yahoo became accessible after 5 seconds
.|..v 08-Mar-01 23:52:32 yahoo became INaccessible after 9 seconds
.|..^ 08-Mar-01 23:52:37 yahoo became accessible after 5 seconds
.|... 08-Mar-01 23:53:05 this thread just stretching itself after 60 seconds
.|v.. 08-Mar-01 23:53:20 www.download.com became INaccessible after 429
seconds
.||v. 08-Mar-01 23:53:22 iae became INaccessible after 493 seconds
.|^|. 08-Mar-01 23:53:26 www.download.com became accessible after 6 seconds
.|.^. 08-Mar-01 23:53:27 iae became accessible after 5 seconds
.|... 08-Mar-01 23:54:05 this thread just stretching itself after 60 seconds
.|v.. 08-Mar-01 23:54:23 www.download.com became INaccessible after 57
seconds
.|^.. 08-Mar-01 23:54:29 www.download.com became accessible after 6 seconds
[stuff deleted]
whereby a set of 5 threads report any state changes of their respective
sites. And an extra thread (the propective victim) injects extra lines every
e.g.
60 seconds to give a rougn indication of time passing. The point about
killing
this thread is that I want the program to terminate when the user hits Esc -
without waiting up to 60 seconds.
Thanks in advance for any help.
My script is already running, POD documented and available on request.
Peter van den Hamer
vdhamer@msn.com
The Netherlands (a country in Europe ;-)
------------------------------
Date: Fri, 9 Mar 2001 19:31:42 -0000
From: "keTTle_drum" <kettle_drum@yahoo.com>
Subject: Re: Newbies welcome
Message-Id: <Naaq6.7791$t1.547014@news6-win.server.ntlworld.com>
And if any newbies are still to scared to post questions on here, feel free
to email me or ask questions at my mailing lists. They are very friendly and
you will get a clear answer.
--
Join the HTMLGold's mailing list at http://groups.yahoo.com/group/htmlgold.
HTMLGold. It's not what you know. It's how it was taught!
Darren <darrenls21@yahoo.com> wrote in message
news:2xVp6.4139$t1.320148@news6-win.server.ntlworld.com...
> This is to all newbies on this and any other newsgroup.
>
> Do not ever be afraid of asking a question on something relevent to the
> newsgroup you are visiting.
> Bear in mind that every single person on any newsgroup was a newbie once,
so
> if they slate you for being a newbie then they are hypocrites and should
be
> ignored. Do not give up. Everybody learns, even the so called experienced
> though they would often not admit it
>
>
>
>
>
------------------------------
Date: Fri, 9 Mar 2001 20:19:55 -0000
From: "Darren" <darrenls21@yahoo.com>
Subject: Re: Newbies welcome
Message-Id: <FZaq6.8148$t1.568517@news6-win.server.ntlworld.com>
you must be good. You just answered a question before i asked it :-)
Raman Sinha <raman@raman-sinha.com> wrote in message
news:B6CDBC5D.4FF5%raman@raman-sinha.com...
> some people simply don't know *how* to look. sometimes you have to hold a
> newbies hand and let them take baby steps. for instance:
>
> i am an asp programmer (not by choice). in asp, to get values for
> querystrings you need to do something like this if your querystring looks
> like this:
>
> www.mypage.com/thispage.asp?asp=sucks
>
> so in my page to mess with it, i'd do something liek this:
>
> dim asp
> howisasp=request.querystring("asp")
>
> (howisasp=sucks now)
>
> BUT the PHP documentation does not remotely go out of it's way to tell you
> that PHP AUTOMATICALLY creates a variable who's name is the key and who's
> value is the key's value.. very logical (why don't they do this in asp?
> because asp sucks) BUT it isn't really mentioned anywhere. = big barrier
to
> entry. if it weren't for a tiny line somewhere on wired and/or someones
> annotation that i barely saw in the documentation i would probably have
> given up and said screw it, i'll do the website in asp instead of wasting
4
> hours trying to figure it out and reading the docs over and over.
>
> of course, now i'm on my way to php gurudom :)
>
> so go ahead - ask a question. if i can't answer it for you i'll tell you
> where you can find the answer in the documentation but you will eventually
> learn to be resourceful.
>
> -raman
>
> in article 3AA857F4.33A84172@indent.com.au, Justin French at
> justin@indent.com.au wrote on 3/8/01 10:12 PM:
>
> > Darren wrote:
> >
> >> Do not ever be afraid of asking a question on something relevent to the
> >> newsgroup you are visiting.
> >> Bear in mind that every single person on any newsgroup was a newbie
once, so
> >> if they slate you for being a newbie then they are hypocrites and
should be
> >> ignored. Do not give up. Everybody learns, even the so called
experienced
> >> though they would often not admit it
> >
> > Yeah, but consulting the manuals, or searching archives (if they exist)
> > might help cut dwon the the traffic and abuse.
>
------------------------------
Date: Fri, 09 Mar 2001 19:23:06 +0000
From: Graham Ellis <graham@wellho.net>
Subject: Re: number of characters (length)
Message-Id: <3AA92D9A.1FEB4EF4@wellho.net>
Francesca,
Change the "+" to "{6,}", which means 6 or more of the previous item - in
this example a word character.
Do beware (if you didn't realise already) that \w matches digits and
underscore characters as well as letters - your definition of a word
character may not agree with that!
Reducing the length to 6 after matching?
$matching =~ s/\b(\w{6})\w*\b/$1/;
Which would replace the first word of six or more "letters" in $matching
with just the first six "letters".
For ease, I've not included the substitution within your if statement. With
just the tiny code fragment you supplied, it's hard to know the context, but
I do wonder if you wanted to replace ALL words of over six characters with
just the first six?
Graham
--
Graham Ellis, Well House Consultants
Melksham, Wiltshire, UK
http://www.wellho.net (Perl training and info)
graham@wellho.net
francesca wrote:
>
> while using this statement below to match words
> what do i need to add to match only the words >= 6 characters
>
> if ($matching=~ /\b(\w+)\b/)
>
> or how could i reduce the length to 6 after the matching ?
> removing the characters form the end only
>
> Thanks
------------------------------
Date: Fri, 09 Mar 2001 19:16:29 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: number
Message-Id: <taib0d1c6qo7c5@corp.supernews.com>
Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
> Waarddebon wrote in comp.lang.perl.misc:
>> In my script i've got some variables with .00 behind it.
>> for example $xx="55.00"
>>
>> Which line do i need so that $xx will contain 55 (so without the .00)
> Several solutions :
> $xx =~ s/\.00$//;
> $xx = substr($xx,0,2);
> $xx = sprintf("%d",$xx);
> $xx =~ /^(\d+)/; $xx = $1;
> etc. (ad nauseam.)
$xx =~ tr/.0//d;
$xx =~ s/\.d+$//; # more general than just zeros, in case
# it is wanted to be like int
$xx += 0; # which someone else I believe pointed out as
# a general solution, too.
$xx = int $xx; # which someone else posted
$xx /= 1;
$xx *= 1;
$xx -= 0;
$xx =~ s/(\d+)(?=\.)/$1/;
> (Well, you haven't been very clear in your problem description).
True, but I think you made some useful suggestions anyway. :-)
Hopefully the OP can choose one out of all the posted ways to
do it. Maybe the benchmark module would help in that regard,
if the overhead of some of these in unclear.
Chris
--
Christopher E. Stith
You must not lose faith in humanity. Humanity is an ocean;
if a few drops of the ocean are dirty, the ocean does not
become dirty. -- Mohandas K. Gandhi
------------------------------
Date: 9 Mar 2001 20:14:56 GMT
From: "Scott R. Godin" <webmaster@webdragon.munge.net>
Subject: Re: Perl & Recursion : Why doesn't this work?
Message-Id: <98bdk0$h2n$1@216.155.32.55>
In article <3AA813CC.8A177446@xilinx.com>, Derrell Durrett
<durrett@xilinx.com> wrote:
| #!/usr/local/bin/perl -w
|
| use strict;
|
| sub factorial
| {
| my $number = shift;
| return 1 unless $number;
| return $number * factorial(--$number);
| }
|
| print factorial(6) . "\n";
sub factorial
{
my $number = shift;
return 1 unless $number;
return $number * factorial($number - 1);
}
the -- decrement to $number won't show up until the NEXT line of code
following the statement in which it occurs.
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Fri, 9 Mar 2001 20:52:31 -0000
From: "Chile" <abcd@ntlworld.com>
Subject: perl code/module to create a dynamic tree TOC menu ??
Message-Id: <Y7bq6.8198$t1.572554@news6-win.server.ntlworld.com>
Hi,
You know those cool tree toc menu's like the ones used in windows explorer.
Does anyone know if there is perl module or perl code that you can store the
folder options in a txt file and then run the script that will create the
tree and display it on the web page??
Thanks,
Scott
------------------------------
Date: Fri, 09 Mar 2001 16:35:01 GMT
From: "Mike Flaherty" <mflaherty2@earthlink.net>
Subject: Perl won't let go of a file open for READ.
Message-Id: <VC7q6.171$xe7.28578@newsread1.prod.itd.earthlink.net>
Hello,
I have a simple routine to read the contents of a file into a scalar. It
works fine but the system won't release the file even though I am only
opening it for READ. NOTE that this only happens via CGI (command line
seems fine). I am using Apache on VMS (csws 1.01) and when I do a "show
dev/files" I see that Apache is still holding on to the file which means
that I can't update it later when I open it for WRITE.
sub get_pending_entries {
$userlist = "web_perl\:userlist.csv";
$pending_entries;
unless (open (DATAPLACE,"$userlist")) {
$pending_entries = "NO PENDING ACCOUNTS";
}
else
{
local $/;
open USERLIST, $userlist;
$pending_entries = <USERLIST>;
close (USERLIST) or die "cannot close $file: $!";
}
if ($pending_entries eq "") {
$pending_entries = "NO PENDING_ACCOUNTS";
}
}
*****************************
VMSNODE> sh dev/files/out=l.l
VMSNODE> sea l.l csv
APACHE$WWW_3 21E0D514 [APACHE_KITS.APACHE.PERL]USERLIST.CSV;1
VMSNODE>
------------------------------
Date: Fri, 09 Mar 2001 19:22:22 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl won't let go of a file open for READ.
Message-Id: <3abiatorrmud0v2uqgr4ap1hvolgi3j4bf@4ax.com>
Mike Flaherty wrote:
>I have a simple routine to read the contents of a file into a scalar. It
>works fine but the system won't release the file even though I am only
>opening it for READ. NOTE that this only happens via CGI (command line
>seems fine). I am using Apache on VMS (csws 1.01) and when I do a "show
>dev/files" I see that Apache is still holding on to the file which means
>that I can't update it later when I open it for WRITE.
Not mod_perl? If so, try localizing the filehandles
local *DATAPLACE;
which ought to close the file if the script ends, even if the process
running the script doesn't end.
HTH,
Bart.
------------------------------
Date: 9 Mar 2001 22:08:28 GMT
From: kmead@socrates.Berkeley.EDU ()
Subject: perl5db.pl question
Message-Id: <98bk8s$ff3$1@agate.berkeley.edu>
I hate it when in the debugger I mistype a variable name when doing
a 'p' or 'x' command and get half a page of useless trace information
about the internals of perl5db.pl.
Is there some way to configure perl5db or create some alias to avoid
this extraneous verbiage?
I thought of alias p to say pp and create my own sub pp that does
a 'eval { print $DB::OUT @_ };' but couldn't get it to work.
Thanks
Keith
------------------------------
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 V10 Issue 456
**************************************