[18630] in Perl-Users-Digest
Perl-Users Digest, Issue: 798 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 30 03:05:48 2001
Date: Mon, 30 Apr 2001 00:05:09 -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: <988614309-v10-i798@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 30 Apr 2001 Volume: 10 Number: 798
Today's topics:
DBD::ODBC <mrp@hafatel.com>
Re: Good editor for perl <mischief@velma.motion.net>
Re: Good editor for perl (Anno Siegel)
Re: Help Me Obi One You're my Only Hope <mischief@velma.motion.net>
Re: How to down size /usr/bin/perl ? <mischief@velma.motion.net>
Re: https module <todd@designsouth.net>
Re: Jeopardy (was Re: First and last element in list lo (Eric Bohlman)
Re: Jeopardy (was Re: First and last element in list lo <bart.lateur@skynet.be>
Re: PERL Code Generator <todd@designsouth.net>
Re: PERL Code Generator (Randal L. Schwartz)
Re: PERL Code Generator <todd@designsouth.net>
Re: PERL Code Generator (Randal L. Schwartz)
Re: perl variables problem <mischief@velma.motion.net>
Question: WWW::Search - the second page <michael_of_neb@MailAndNews.com>
reg exp <troyr@vicnet.net.au>
Re: reg exp <wyzelli@yahoo.com>
Re: reg exp (Logan Shaw)
Re: reg exp <troyr@vicnet.net.au>
Re: regular expression question <todd@designsouth.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 30 Apr 2001 13:59:32 +1000
From: "Michael R. McPherson" <mrp@hafatel.com>
Subject: DBD::ODBC
Message-Id: <9cio8k01qcd@enews1.newsguy.com>
I have DBD::ODBC installed using Openlink with iodbc. Whe I run a script
from the shell it works as is expected. Same script yet run via a web page
and it returns the following error.
Couldn't connect to database[OpenLink][ODBC]RPC: Unknown host (SQL-08004)
[OpenLink][ODBC]Connection rejected by data source (SQL-08004)(DBD:
db_login/SQLConnect err=-1) at /home/httpd/cgi-bin/hafa.pl line 18.
What could I be doing wrong ?
--
##############Þ
print "\n Welcome to NEPP";$Þ=1;while ($Þ){
print "\n$Þ";$Þ++;if ($Þ == 1000) {
print "\n$Þ"."\nWell almost never ending :þ";exit;}}
##############Þ
------------------------------
Date: Mon, 30 Apr 2001 04:08:59 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Good editor for perl
Message-Id: <tepparj5no4m1b@corp.supernews.com>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> According to Philip Newton <nospam.newton@gmx.li>:
>> On 25 Apr 2001 21:12:14 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
>> Siegel) wrote:
>>
>> > Slightly more on topic, yet still going on about vim: what I miss
>> > more than any syntax hilighter (which I don't trust enough) is
>> > the ability to use the QuickFix feature[1].
>> [snip]
>> > Hmm "use Unix::QuickFix;" sounds snappy...
>>
>> Why "Unix"? Doesn't vim's QuickFix feature work on other platforms,
>> too?
> You are absolutely right, it does.
> As usual when planning a module, its placement in the CPAN hierarchy
> turns out to be th hardest problem. :)
Honestly, I really don't use QuickFix. I do love the ability
to read the line number from the error message and to go to
the line so quickly, such as ':935'.
Chris
--
Product shown enlarged to make you think you're getting more.
------------------------------
Date: 30 Apr 2001 04:47:11 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Good editor for perl
Message-Id: <9ciqof$oq6$1@mamenchi.zrz.TU-Berlin.DE>
According to Chris Stith <mischief@velma.motion.net>:
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > According to Philip Newton <nospam.newton@gmx.li>:
> >> On 25 Apr 2001 21:12:14 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
> >> Siegel) wrote:
> >>
> >> > Slightly more on topic, yet still going on about vim: what I miss
> >> > more than any syntax hilighter (which I don't trust enough) is
> >> > the ability to use the QuickFix feature[1].
> >> [snip]
> >> > Hmm "use Unix::QuickFix;" sounds snappy...
> >>
> >> Why "Unix"? Doesn't vim's QuickFix feature work on other platforms,
> >> too?
>
> > You are absolutely right, it does.
>
> > As usual when planning a module, its placement in the CPAN hierarchy
> > turns out to be th hardest problem. :)
>
> Honestly, I really don't use QuickFix.
Well, you can't, with Perl. Not without some filter (easily written
in Perl) that reformats the error messages somewhat.
> I do love the ability
> to read the line number from the error message and to go to
> the line so quickly, such as ':935'.
It isn't so much the line number, though I dislike the way it goes
out of sight before you type it in. I mean, that "935" occupies
valuable short-term memory you want to use for debugging. :)
In multi-file sources, where modules may be in various subdirectories
I like the ability to say "vim -q" and be positioned in the file where
the first error occurred, plus the ability to jump to other errors
(":cn"). This is particularly nice with library modules and their
lengthy path names.
Anno
------------------------------
Date: Mon, 30 Apr 2001 06:27:55 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Help Me Obi One You're my Only Hope
Message-Id: <teq1fbau56533@corp.supernews.com>
Tuan Ngo <tuan.ngo1@home.com> wrote:
> Need assistance with writing a Perl Script for
> the following problem... Any help will be much
> appreciated... I may be able to provide compensation.....
Let's talk about that compensation. I give away a lot of
advice for free. I do not usually write homework^W job
requirement programs for other from scratch for free.
First of all, if you're going to quote on the the most
famous series of movies and books in the world, spell
the names of the characters correctly. It's Obi-Wan
Kenobi. Check the line you think you're quoting, too.
His last name is part of the line.
Secondly, as I'm certain Tad has pointed out in his post,
please use the Subject: line for its intended purpose.
Since it has an intended purpose, you did not use it for
that, and I'm feeling generous and insomniatic, I took
pity enough to read most of a post that really doesn't
interest me.
Thirdly, if the compensation you mention is enough, you
may regain my interest. Job offers go to mail, though,
or to a forum intended for them, such as Dice or the
Perl jobs mailing list ( jobs-subscribe@perl.org if you
wish to subscribe ).
Chris
--
Disclaimer: Actual product may not resemble picture in ad in any way.
------------------------------
Date: Mon, 30 Apr 2001 06:08:47 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: How to down size /usr/bin/perl ?
Message-Id: <teq0bfcq8hsibb@corp.supernews.com>
Logan Shaw <logan@cs.utexas.edu> wrote:
> In article <3aec3ea0.6341$384@news.op.net>,
> Mark Jason Dominus <mjd@plover.com> wrote:
>>
>>In article <9ccr0o$nog$1@daggoo.cs.utexas.edu>,
>>Logan Shaw <logan@cs.utexas.edu> wrote:
>>>First, you've got to decide whether the C/C++/Perl/Java family of
>>>syntaxes is wonderful and the Algol/Pascal/Modula-2/Ada family is evil,
>>
>>Your notion of programming language syntax seems impoverished.
>>C, C++, Perl, and Java *are* in the Algol family of syntax.
>>
>>For counterexamples, see Prolog, Common Lisp, Cobol, Fortran, and Haskell.
> I have used Prolog, Lisp, and Haskell, and I realize they're different,
> though it's not the syntax itself that's the chief difference.
> (Actually my comment about making the notation look as much like some
> other notation as possible was a jab at Haskell, which IMHO makes the
> syntax unnecessarily confusing by trying to make it look like
> mathematical notation.)
If I was a mathematician, I'd probably want my language
to look like mathematical notation. Some people to this
day think COBOL's verbosity and roughly sentence-like
structure are helpful.
> Still, I think most people these days choose to either copy C's or
> Pascal's syntax. I agree that the two don't work that much
> differently, but most people designing a new language aren't going to
> make it a functional or logic language anyway.
C has some touches of functional languages in it. So
does Perl. The fact that you don't have to return a
value and the fact that you can have side effects
doesn't mean there aren't some inspirations from
functional languages present. C, C++, Java, and
especially Perl are all built around compromise among
different absolutes. I wouldn't call Perl a functional
language, but a function is just a special case of a
procedure. All imperative languages have a lot in common.
To tell the truth, I've been looking at OCAML recently.
It's a jump from doing most of my work in Perl with
tiny bits of C to doing any serious work with OCAML,
but it's not nearly as much of a jump as when I switched
from Rexx to Forth as hobby languages in high school. All
things are relative.
> my your his her our their _its_
> I'm you're he's she's we're they're _it's_
'tis and 'twas are my faves
mine yours his hers ours theirs _its_
Chris
--
Disclaimer: Actual product may not resemble
picture in ad in any way.
------------------------------
Date: Mon, 30 Apr 2001 05:44:54 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: https module
Message-Id: <qZ6H6.41861$U4.9892326@news1.rdc1.tn.home.com>
"Brian Richardson" <lamecow78@hotmail.com> wrote in message
news:cKXG6.66654$Zn4.718551@news1.rdc1.ab.home.com...
>
> "Paul Cotter" <prcotter@bellsouth.net> wrote in message
> news:fQ%F6.1649$5B4.665630@news2.mia...
> > "smilepak" <smilepak@hotmail.com> wrote in message
> > news:BJID6.971$cM1.57429@newsread1.prod.itd.earthlink.net...
> >
> > > I need to access a secure http site to pull data on a daily basis. The
> > site
> > > request a username/password. Anyone know of a way I can get perl to do
a
> > > https call and passing a username/password when it request for it?
> > >
> > > I know perl has a "GET" function, however that doesn't work with
secure
> > http
> > > server.
> > >
>
> [ snip ]
>
> Ouch! That's a lot of code for a simple thing that could be done using
> LWP::UserAgent;
> Check the documentation on CPAN to double-check that it does what you
need.
> You may also need to look into LWP::SecureSockets and Net::SSLeay should
you
> in fact be dealing with a secure server.
>
> HTH,
> Brian
>
Can anybody connect to www.gamesville.com? I can't get LWP or CGI to work,
or 'lynx -dump' or 'wget'. Does anybody know how?
------------------------------
Date: 30 Apr 2001 04:08:50 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Jeopardy (was Re: First and last element in list loop)
Message-Id: <9ciogi$83f$1@bob.news.rcn.net>
bowman <bowman@montana.com> wrote:
> A long time ago (when Delphi was alive and well), a poster in one of the
> groups was blind, and used a text to speech program. He requested people
> replying to his posts to put the answer first as he was tired of listening
> to his questions. I'd assume the text to speech proggies have gotten smarter
> since then and can skip '>' lines. Good argument, though, for not using
> one's private little quoted material demarkers.
Even better argument, though, for aggressively *trimming* the material you
quote. It is *not* necessary for each entry in a thread to contain a
quote of the entire thread, or even of the entire previous entry. Those
who tell you otherwise are trolls (who frequently complain if you don't
repeat everything they say).
------------------------------
Date: Mon, 30 Apr 2001 06:51:55 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Jeopardy (was Re: First and last element in list loop)
Message-Id: <6q2qetcm2v1pen6dd2un7hc9hvisqjudvo@4ax.com>
bowman wrote:
>A long time ago (when Delphi was alive and well), a poster in one of the
>groups was blind, and used a text to speech program. He requested people
>replying to his posts to put the answer first as he was tired of listening
>to his questions. I'd assume the text to speech proggies have gotten smarter
>since then and can skip '>' lines.
Ah? So what if the only thing he hears is "yes"?
How can he EVER know what people are talking about? If he asked 10
questions, what question is he hearing the answer to? What if he's
listening to the answer to other people's questions?
The tool you're talking about should have a "skip to next section"
button, but not skip text by default.
--
Bart.
------------------------------
Date: Mon, 30 Apr 2001 04:56:24 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: PERL Code Generator
Message-Id: <Yf6H6.41778$U4.9860021@news1.rdc1.tn.home.com>
to be fair, codecharge is a cool program, and the people that make
CodeCharge didn't post this spam- this is from a company that's selling it.
"Randal L. Schwartz" <merlyn@stonehenge.com> wrote in message
news:m17l0g7lpv.fsf@halfdome.holdit.com...
> >>>>> "Michael" == Michael Wenzelmaier <michaelw@elkhart.net> writes:
>
> Michael> "CodeCharge is a powerful code generator that helps web
> Michael> developers and non-programmers create database-driven web
> Michael> applications in a matter of hours. You may use it to easily
> Michael> create any types of web forms and grids, such us User
> Michael> Registration Form for the web site or an Event List, or you
> Michael> may generate full featured Employee Directories, Forums and
> Michael> Task Management Systems up to advanced Online Auctions,
> Michael> Stores, Portals and Intranets. In fact, CodeCharge comes with
> Michael> many of such solutions already pre-built and you may easily
> Michael> customize them to your needs. CodeCharge works by letting you
> Michael> select database fields to be included on each web page and
> Michael> specifying how they should interact. It then generates
> Michael> database-driven, dynamic websites in many server-programming
> Michael> languages such as ASP, ColdFusion, JSP, PHP and Perl."
>
> Michael> http://www.[deleted]/codecharge
>
> "SpamForCodeCharge is a powerful spam generator that helps
> WebProCenter and their marketeers create spam-driven Usenet postings
> in a matter of minutes. You may use it to easily create any types of
> Spam and Usenet Postings, such us [sic] Cash Diverter Form for the
> Usenet post or a rented Mailing List, or you may generate full
> featured Spam Lists, Forum Autoinserts, and Spamhauses. In fact
> SpamForCodeCharge comes with many of such mailing lists and newsgroups
> already prebuilt and you can easily customize them to your needs.
> SpamForCodeCharge works by letting you select names for database
> fields to be included in each spam page and specifying how you want
> the victim, er, customer to interact. It then generates
> database-driven, dynamic spam in many spammish languages such as
> Usenet, Email, Web Forums, Fax, Pager, and cellphone spam."
>
> http://www.get.a.clue/spamforcodecharge
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!
------------------------------
Date: 29 Apr 2001 23:13:44 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: PERL Code Generator
Message-Id: <m17l02ewyv.fsf@halfdome.holdit.com>
>>>>> "Todd" == Todd Smith <todd@designsouth.net> writes:
Todd> to be fair, codecharge is a cool program, and the people that
Todd> make CodeCharge didn't post this spam- this is from a company
Todd> that's selling it.
So, at this point, the people who *make* CodeCharge should either
tell us that they've forbidden this company to represent them
further, or they themselves are also as guilty as the spammers.
In the absence of further comment, I can still blame the people who
make CodeCharge, and cannot recommend anything related to that in good
conscience.
print "Just another Perl hacker," # and respector of Usenet principles
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 30 Apr 2001 06:16:47 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: PERL Code Generator
Message-Id: <jr7H6.41875$U4.9911968@news1.rdc1.tn.home.com>
"Randal L. Schwartz" <merlyn@stonehenge.com> wrote in message
news:m17l02ewyv.fsf@halfdome.holdit.com...
> The following message is a courtesy copy of an article
> that has been posted to comp.lang.perl.misc as well.
>
> >>>>> "Todd" == Todd Smith <todd@designsouth.net> writes:
>
> Todd> to be fair, codecharge is a cool program, and the people that
> Todd> make CodeCharge didn't post this spam- this is from a company
> Todd> that's selling it.
>
> So, at this point, the people who *make* CodeCharge should either
> tell us that they've forbidden this company to represent them
> further, or they themselves are also as guilty as the spammers.
why would you blame a company for something they didn't do, and probably
don't know about?
>
> In the absence of further comment, I can still blame the people who
> make CodeCharge, and cannot recommend anything related to that in good
> conscience.
>
> print "Just another Perl hacker," # and respector of Usenet principles
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!
>
------------------------------
Date: 29 Apr 2001 23:39:35 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: PERL Code Generator
Message-Id: <m1vgnmdh7c.fsf@halfdome.holdit.com>
>>>>> "Todd" == Todd Smith <todd@designsouth.net> writes:
Todd> why would you blame a company for something they didn't do, and probably
Todd> don't know about?
Strike 1 - top posting
Strike 2 - stealth-CC-ing me
Strike 3 - defending spammers and spam associates
*plonk*
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 30 Apr 2001 04:50:25 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: perl variables problem
Message-Id: <teprohklh0dt32@corp.supernews.com>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> According to Chris Stith <mischief@velma.motion.net>:
>> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> > According to Sylvain Thevoz <sylvain.thevoz@mcnet.ch>:
>> >> I have a file which contents:
>> >> $a Mr. Smith, how do you do?
>>
>> > Avoid the use of variables $a and $b. See perldoc -f sort for why.
[snip]
>> >> My problem:
>> >> when I execute the perl file, it prints "$a Mr. Smith, how do you do?"
[snip]
>> > Here is one way to do what you want:
>>
>> > my $line = '$x Mr. Smith, how do you do?';
>> > my $x = 'Good morning';
>> > print $line, ' -> ', eval "qq/$line/", "\n";
>> > Prints:
>> > $x Mr. Smith, how do you do? -> Good morning Mr. Smith, how do you do?
[snip]
>> > A safer way to accomplish the same thing is to use a substitution
>> > operator: "$line =~ s/\$x/$x/g". Of course, now there is no need
>> > to name the bit that has to be substituted like the Perl variable
>> > that contains the substitution, any unique string would do. This
>> > further decouples the program from the data, which is a good thing.
>>
>> ...but you don't have to eval the whole thing. You don't really even
>> have to eval anything from the file.
>>
>> s/\$a/$a/;
> Why, yes. That's what I suggest im my last paragraph above.
Yes, I see that now. My apologies for my failure to see that
initially.
Text::Template is probably worth a look in any case.
Chris
--
For the pleasure of others, please adhere to the following
rules when visiting your park:
No swimming. No fishing. No flying kites. No frisbees.
No audio equipment. Stay off grass. No pets. No running.
------------------------------
Date: Mon, 30 Apr 2001 01:36:28 -0400
From: Michael <michael_of_neb@MailAndNews.com>
Subject: Question: WWW::Search - the second page
Message-Id: <3B066D89@MailAndNews.com>
Hi.
How do you make the search using these modules continue after the first page
?
Maybe I'm dense, but what's the secret here ?
I don't seem to get it, and yet I don't think that people have been content
with a single page of search on these engines for all these years that they
have been around, right ?
It should be simple, right ?
"Using the library "SHOULD" be straightforward. Here is a sample program:
my $search = new WWW::Search('AltaVista');
$search->native_query(WWW::Search::escape_query($query));
while (my $result = $search->next_result())
{
print $result->url, "\n";
}
"
This method, and many very much just like it, do quite well at reading the
first page of the search, and reporting on the contents of the first page,
and
then doing the same page over and over again.
What do I have to do ?
There MUST be a simple trick, but I just don't get it.
I would be VERY grateful for an answer to this puzzlement.
Thank you.
Michael
NOSPAMmichael_of_neb@NOSPAMmailandnews.com
(You can figure it out, just chop off the NOSPAM parts.)
posted to:
News:nntp.mailandnews.com/comp.lang.perl.misc
News:nntp.mailandnews.com/comp.lang.perl.modules
------------------------------
Date: Mon, 30 Apr 2001 16:27:34 +1000
From: "Troy Boy" <troyr@vicnet.net.au>
Subject: reg exp
Message-Id: <rE7H6.2570$VM5.79241@ozemail.com.au>
Hi there
say $var="-rwxr-xr-x 1 troyr staff 101 Apr 30 16:22 test.cgi";
I want to make a reg ex that replaces all spaces with 1 percentage sign
If i do $var=~ s/ /%/g ;
It replaces every occurence making var
="-rw-r--r--%%%%1%troyr%%%%staff%%%%%2435905%Mar%21%10:30%/home/troyr/210300
.txt"
Does anyone know of a way to make it only replace spaces which are together
with 1 % sign
ie between troyr and staff should only be 1 % sign not 4
Thanks in advance
--
----------------------------------------------------------------
Troy Rasiah
Melbourne, Aus
------------------------------
Date: Mon, 30 Apr 2001 16:32:37 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: reg exp
Message-Id: <WS7H6.14$lX5.2021@vic.nntp.telstra.net>
"Troy Boy" <troyr@vicnet.net.au> wrote in message
news:rE7H6.2570$VM5.79241@ozemail.com.au...
> Hi there
>
> say $var="-rwxr-xr-x 1 troyr staff 101 Apr 30 16:22
test.cgi";
>
> I want to make a reg ex that replaces all spaces with 1 percentage sign
>
> If i do $var=~ s/ /%/g ;
>
> It replaces every occurence making var
>
="-rw-r--r--%%%%1%troyr%%%%staff%%%%%2435905%Mar%21%10:30%/home/troyr/210300
> .txt"
>
> Does anyone know of a way to make it only replace spaces which are
together
> with 1 % sign
>
> ie between troyr and staff should only be 1 % sign not 4
>
For single character translations you should look into the tr/// (y///)
operator. Not only is it faster than s///, it also has a modifier to do
exactly what you want.
read about it in perlop.
For what you want, tr/ /%/s should do the trick
Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: 30 Apr 2001 01:48:07 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: reg exp
Message-Id: <9cj1r7$5s5$1@charity.cs.utexas.edu>
In article <rE7H6.2570$VM5.79241@ozemail.com.au>,
Troy Boy <troyr@vicnet.net.au> wrote:
>Hi there
>
>say $var="-rwxr-xr-x 1 troyr staff 101 Apr 30 16:22 test.cgi";
>
>I want to make a reg ex that replaces all spaces with 1 percentage sign
>
>If i do $var=~ s/ /%/g ;
You need to have your pattern match multiple successive spaces.
Luckily, regular expressions allow you to put a "+", which means "match
1 or more of the previous thing".
So, just do
$var =~ s/ +/%/g;
Hope that helps.
- Logan
--
my your his her our their _its_
I'm you're he's she's we're they're _it's_
------------------------------
Date: Mon, 30 Apr 2001 16:45:14 +1000
From: "Troy Boy" <troyr@vicnet.net.au>
Subject: Re: reg exp
Message-Id: <%U7H6.2577$VM5.79327@ozemail.com.au>
>
> For what you want, tr/ /%/s should do the trick
>
Thanks kindly :)
------------------------------
Date: Mon, 30 Apr 2001 05:01:52 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: regular expression question
Message-Id: <4l6H6.41807$U4.9864805@news1.rdc1.tn.home.com>
"whitetigercat" <whitetiger@pinc.com> wrote in message
news:tdqcqcs1iqq613@corp.supernews.com...
> Hi all,
> I've been playing around with regular expressions and can't seem to find
an answer to this:
> If I have a pattern, how can i delete everything in the string doesn't
match that pattern?
> For example, if $content is an HTML page that contains a FORM and $pattern
= "<input ([^>]|\n)*>"
> i.e. input statements in an HTML FORM, how can i delete everything in the
page except
> these INPUT tags so I can do further processing on them? I've tried
numerous methods.
> Any help appreciated.
> --Shane
>
>
$_ = "big long long string";
while (/long /) { #the match
$_ = "$`$'"; #everything else
}
-todd
------------------------------
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 798
**************************************