[28245] in Perl-Users-Digest
Perl-Users Digest, Issue: 9609 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 15 18:05:43 2006
Date: Tue, 15 Aug 2006 15:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 15 Aug 2006 Volume: 10 Number: 9609
Today's topics:
Re: Beginner: little rand() question in a long posting <mumia.w.18.spam+nospam.usenet@earthlink.net>
Re: Beginner: little rand() question in a long posting <mstep@t-online.de>
cgi-bin/guestbook.pl <jay@ukjay.co.uk>
initialize a hash <rvtol+news@isolution.nl>
Re: initialize a hash <mritty@gmail.com>
Re: initialize a hash <uri@stemsystems.com>
Re: initialize a hash anno4000@radom.zrz.tu-berlin.de
Re: js input reqd <syscjm@gwu.edu>
Re: My multipost-detecting usenet bot (David Filmer) usenet@DavidFilmer.com
Re: My multipost-detecting usenet bot (David Filmer) axel@white-eagle.invalid.uk
Re: Parsing text to array anno4000@radom.zrz.tu-berlin.de
Re: perl dbi driver for microsoft sql? <mritty@gmail.com>
Re: perl dbi driver for microsoft sql? <sherm@Sherm-Pendleys-Computer.local>
Re: perl dbi driver for microsoft sql? <mritty@gmail.com>
Re: perl dbi driver for microsoft sql? <markrat@gmail.com>
Re: Proposal: extending perldoc -f <bik.mido@tiscalinet.it>
Re: Proposal: extending perldoc -f <jgibson@mail.arc.nasa.gov>
Regex Help lmcosorio@hotmail.com
Re: Regex Help <1usa@llenroc.ude.invalid>
Re: UK Recruitment for Junior Perl Developer <dha@panix.com>
Re: Website Interface Zyad.Tamimi@gmail.com
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 15 Aug 2006 18:34:34 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: Beginner: little rand() question in a long posting ...
Message-Id: <_soEg.6274$Qf.4858@newsread2.news.pas.earthlink.net>
On 08/15/2006 10:27 AM, Marek Stepanek wrote:
> [...]
> main::random_int_in() called too early to check prototype at ./calc_hours.pl
> line 54.
Prototypes are not often used in Perl. My advice is to avoid
them, but if you use them, they must appear before the
function invokation, so this won't work right:
my $value = my_function(3,19);
sub my_function($$) {
...
}
But this will work right:
sub my_function($$); # <---- declares prototype
my $value = my_function(3,19);
sub my_function($$) {
...
}
> Argument "185.88 / 1.8" isn't numeric in sprintf at ./calc_hours.pl line 63,
> <IN> line 61 ...
>
This line,
my $km_tag = "$sum / $random_km" if $sum;
Does not perform a calculation because you assign a string to
$km_tag. Remove the quotes to allow Perl to perform a
calculation.
> This script is long, sorry:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> #### Files #################
> my $in_file = 'calc_hours_in.tex';
> open IN, "< $in_file" or die "Could not open your in_file: $!";
> my $out_file = 'calc_hours.tex';
> open OUT, "> $out_file" or die "Connot create your out_file: $!";
> ####END Files ##############
>
> my $latex_head = <<"EOF";
> \\documentclass[a4]{scrartcl}
> \\usepackage[utf8]{inputenc}
> [...]
LaTeX loves those backslashes :-) . To avoid double-backslash
madness, you could have used different quoting method:
my $latex_head = q{
\documentclass[a4]{scrartcl}
\usepackage[utf8]{inputenc}
...
};
Or you could have read the data in from a separate file.
Good luck.
------------------------------
Date: Tue, 15 Aug 2006 21:47:19 +0200
From: Marek Stepanek <mstep@t-online.de>
Subject: Re: Beginner: little rand() question in a long posting ...
Message-Id: <C107F167.2A383%mstep@t-online.de>
On 15.08.2006 19:00, in article
g69odum6ijo.fsf@CN1374059D0130.kendall.corp.akamai.com, "Ted Zlatanov"
<tzz@lifelogs.com> wrote:
>
> I wanted to mention two things in addition to Paul Lalli's comments.
>
> First, you have "STATEMENT if $sum" many times. Just use one if:
>
> if ($sum)
> {
> a;
> b;
> c;
> }
>
Yes you are right; this was to avoid the many " uninitialized values " in my
shell!
Thank you, spaciba bolshoi, Ted! My Math-Teacher long long time ago, always
said: "elegance = (practice + studiousness) ^ intelligence ... You must be
very intelligent :-)
>
> $random_km = 1.5 + rand(0.3); # random between 1.5 and 1.7999...
>
That's exactly I wanted to achieve!
>
> Check out "perldoc -f rand" for more info.
>
> Ted
greetings from Munich
marek
------------------------------
Date: 15 Aug 2006 14:58:41 -0700
From: "UkJay" <jay@ukjay.co.uk>
Subject: cgi-bin/guestbook.pl
Message-Id: <1155679121.469501.323790@74g2000cwt.googlegroups.com>
I'm getting cheesed off with the pathetic attemps from hackers trying
to find this script.
Has anyone written a simple tasty version that deletes files?
I don't think a warning would help, or should I just keep quiet and
write my own??
(If I can find the time)
James(UkJay)
------------------------------
Date: Tue, 15 Aug 2006 21:31:59 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: initialize a hash
Message-Id: <ebtegm.1go.1@news.isolution.nl>
I am investigating what is the fastest way to set up a hash, with the
keys coming from an array, and all values set to a constant like 1.
#!/usr/bin/perl
use warnings ;
use strict ;
use Benchmark qw(:hireswallclock cmpthese) ;
my @list = 1..1000 ;
cmpthese( -3, {
mapE => sub { my %a = map(( $_ => 1 ), @list)},
mapB => sub { my %a = map { $_ => 1 } @list },
for => sub { my %a ; $a{ $_ } = 1 for @list },
list => sub { my %a ; @a{ @list } = @list },
range => sub { my %a ; @a{ @list } = 1..@list },
empty => sub { my %a ; @a{ @list } = () },
} ) ;
__END__
Rate mapB mapE list for range empty
mapB 509/s -- -6% -31% -37% -50% -66%
mapE 544/s 7% -- -26% -33% -46% -64%
list 734/s 44% 35% -- -10% -27% -51%
for 812/s 60% 49% 11% -- -20% -46%
range 1012/s 99% 86% 38% 25% -- -32%
empty 1492/s 193% 174% 103% 84% 47% --
From this, I deduce that I need an unlimited supply of ones (in list
context), something like (invalid code follows) C<@1> or C<1...0>.
Suggestions anyone?
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 15 Aug 2006 12:47:48 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: initialize a hash
Message-Id: <1155671268.901097.167560@b28g2000cwb.googlegroups.com>
Dr.Ruud wrote:
> I am investigating what is the fastest way to set up a hash, with the
> keys coming from an array, and all values set to a constant like 1.
>
> #!/usr/bin/perl
> use warnings ;
> use strict ;
>
> use Benchmark qw(:hireswallclock cmpthese) ;
>
> my @list = 1..1000 ;
>
> cmpthese( -3, {
> mapE => sub { my %a = map(( $_ => 1 ), @list)},
> mapB => sub { my %a = map { $_ => 1 } @list },
> for => sub { my %a ; $a{ $_ } = 1 for @list },
> list => sub { my %a ; @a{ @list } = @list },
> range => sub { my %a ; @a{ @list } = 1..@list },
> empty => sub { my %a ; @a{ @list } = () },
> } ) ;
> __END__
>
> Rate mapB mapE list for range empty
> mapB 509/s -- -6% -31% -37% -50% -66%
> mapE 544/s 7% -- -26% -33% -46% -64%
> list 734/s 44% 35% -- -10% -27% -51%
> for 812/s 60% 49% 11% -- -20% -46%
> range 1012/s 99% 86% 38% 25% -- -32%
> empty 1492/s 193% 174% 103% 84% 47% --
>
>
> From this, I deduce that I need an unlimited supply of ones (in list
> context), something like (invalid code follows) C<@1> or C<1...0>.
> Suggestions anyone?
Not sure if this is what you meant, but it doesn't seem to be
significantly faster than the 'range' above...:
cmpthese( -3, {
mapE => sub { my %a = map(( $_ => 1 ), @list)},
mapB => sub { my %a = map { $_ => 1 } @list },
for => sub { my %a ; $a{ $_ } = 1 for @list },
list => sub { my %a ; @a{ @list } = @list },
range => sub { my %a ; @a{ @list } = 1..@list },
empty => sub { my %a ; @a{ @list } = () },
x1s => sub { my %a ; @a{ @list } = (1) x @list },
} ) ;
__END__
Rate mapB mapE list for x1s range empty
mapB 243/s -- -0% -9% -41% -48% -48% -62%
mapE 243/s 0% -- -8% -41% -48% -48% -62%
list 266/s 10% 9% -- -36% -43% -43% -58%
for 412/s 70% 69% 55% -- -11% -12% -35%
x1s 464/s 91% 90% 74% 12% -- -1% -27%
range 467/s 93% 92% 76% 13% 1% -- -27%
empty 638/s 163% 162% 140% 55% 38% 37% --
Paul Lalli
------------------------------
Date: Tue, 15 Aug 2006 16:01:00 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: initialize a hash
Message-Id: <x7u04dn4zn.fsf@mail.sysarch.com>
>>>>> "R" == Ruud <rvtol+news@isolution.nl> writes:
R> I am investigating what is the fastest way to set up a hash, with the
R> keys coming from an array, and all values set to a constant like 1.
R> #!/usr/bin/perl
R> use warnings ;
R> use strict ;
R> use Benchmark qw(:hireswallclock cmpthese) ;
R> my @list = 1..1000 ;
R> cmpthese( -3, {
R> mapE => sub { my %a = map(( $_ => 1 ), @list)},
R> mapB => sub { my %a = map { $_ => 1 } @list },
R> for => sub { my %a ; $a{ $_ } = 1 for @list },
R> list => sub { my %a ; @a{ @list } = @list },
R> range => sub { my %a ; @a{ @list } = 1..@list },
R> empty => sub { my %a ; @a{ @list } = () },
R> } ) ;
you missed this one:
x => sub { my %a ; @a{ @list } = (1) x @list },
for basic boolean set testing i have used the empty style and exists or
the x style. if i want to have only a single statement i have used the
map styles (you didn't try the variation of using undef for the values
but that needs exists for testing again.).
also try different size lists as that will affect many things. so this
could be run in a loop with different list sizes.
R> Rate mapB mapE list for range empty
R> mapB 509/s -- -6% -31% -37% -50% -66%
R> mapE 544/s 7% -- -26% -33% -46% -64%
R> list 734/s 44% 35% -- -10% -27% -51%
R> for 812/s 60% 49% 11% -- -20% -46%
R> range 1012/s 99% 86% 38% 25% -- -32%
R> empty 1492/s 193% 174% 103% 84% 47% --
R> From this, I deduce that I need an unlimited supply of ones (in list
R> context), something like (invalid code follows) C<@1> or C<1...0>.
R> Suggestions anyone?
i would have guessed empty to be the fastest style as it doesn't
actually allocate an sv for each hash value, just marks them with the
undef flag. this is different than if you actually assigned undef in the
map styles which would allocate a full sv and mark it as undef.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 15 Aug 2006 20:03:27 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: initialize a hash
Message-Id: <4kenkfFbqebmU1@news.dfncis.de>
Dr.Ruud <rvtol+news@isolution.nl> wrote in comp.lang.perl.misc:
> I am investigating what is the fastest way to set up a hash, with the
> keys coming from an array, and all values set to a constant like 1.
>
> #!/usr/bin/perl
> use warnings ;
> use strict ;
>
> use Benchmark qw(:hireswallclock cmpthese) ;
>
> my @list = 1..1000 ;
>
> cmpthese( -3, {
> mapE => sub { my %a = map(( $_ => 1 ), @list)},
> mapB => sub { my %a = map { $_ => 1 } @list },
> for => sub { my %a ; $a{ $_ } = 1 for @list },
> list => sub { my %a ; @a{ @list } = @list },
> range => sub { my %a ; @a{ @list } = 1..@list },
> empty => sub { my %a ; @a{ @list } = () },
> } ) ;
> __END__
>
> Rate mapB mapE list for range empty
> mapB 509/s -- -6% -31% -37% -50% -66%
> mapE 544/s 7% -- -26% -33% -46% -64%
> list 734/s 44% 35% -- -10% -27% -51%
> for 812/s 60% 49% 11% -- -20% -46%
> range 1012/s 99% 86% 38% 25% -- -32%
> empty 1492/s 193% 174% 103% 84% 47% --
>
>
> From this, I deduce that I need an unlimited supply of ones (in list
> context), something like (invalid code follows) C<@1> or C<1...0>.
> Suggestions anyone?
The repetition operator. Adding
repet => sub { my %a ; @a{ @list } = (1) x @list },
to your benchmark shows it as fast as "range" on my machine, setting
all values to one. Can't beat "empty", though.
Anno
------------------------------
Date: Tue, 15 Aug 2006 16:11:22 -0400
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: js input reqd
Message-Id: <12e4ajb4543393b@corp.supernews.com>
a@tempinbox.com wrote:
> guys i m trying to figure out which javascript toolkit to use
>
> i m now trying to figure out which to use between
> The major contenders are:
> Dojo
> Mochikit
> and prototype [rails fame]
>
> i would love to find out which is very pythonic and clean
> if you can also tell about your experience of using one of these
> thanks
>
I'm sorry, I must have missed something. What was your
Perl question, again?
Chris Mattern
------------------------------
Date: 15 Aug 2006 11:08:13 -0700
From: usenet@DavidFilmer.com
Subject: Re: My multipost-detecting usenet bot (David Filmer)
Message-Id: <1155665293.580789.90930@i3g2000cwc.googlegroups.com>
John Bokma wrote:
> Personally I don't have a problem with a crosspost if it's really needed
> *and* has the follow-up to header set to the most appropriate group.
In my observation, many (if not most) crossposts come from
GoogleGroups. You cannot set a follow-up in GG - it does it for you
(and I'm 99.9% sure it sets it for all groups you've x-posted to).
Many new OPs, I believe, don't really know how (functionally) to
crosspost (and I think that's one reason why they multipost). I'm
reluctant to suggest that crossposting might be OK because many of
those posters won't read the fine print, and I think new OPs will
readily abuse it - they will tend to crosspost similar Perl newsgroups
(with all-inclusive follow-ups) and the groups will begin to look like
mirrors of each other.
I believe that it's unusual for most people to have a valid need to
crosspost (I can't recall needing to crosspost in years, and I rarely,
if ever, see Perl crossposts from known and respected posters, unless
it's a reply to an x-posted message with broad follow-ups). I think it
would be downright rare for a new poster to have a valid need to
crosspost, and I'd rather take a discouraging posture when mentioning
it.
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Tue, 15 Aug 2006 19:42:50 GMT
From: axel@white-eagle.invalid.uk
Subject: Re: My multipost-detecting usenet bot (David Filmer)
Message-Id: <_spEg.13864$lv.6060@fed1read12>
John Bokma <john@castleamber.com> wrote:
> "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net> wrote:
>> On 08/14/2006 05:28 PM, usenet@DavidFilmer.com wrote:
>>> [...]
>>> If I've angered or annoyed anyone, I do apologize. I had no such
>>> intent.
>>> [...]
>> Thank you Mr. Filmer. I can see how the 'bot would reduce a
>> lot of work, but, as you've acknowledged, its message was a
>> little long and harsh.
>> Whatever you do, please don't release the code. Hip-ç-rime
>> would make usenet a nightmare with it.
> Uhm? People who need such programs can just download them including
> software to auto-cancel and repost massively.
It makes me wonder what software Cantor & Siegel used in their
infamous massive multiposting.
And that was over a decade ago.
I probably mentioned it before, but I found their book _How to Make a
Fortune on the Information Superhighway _ in a remainder bookshop and
bought it just for fun.
Axel
------------------------------
Date: 15 Aug 2006 19:17:51 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Parsing text to array
Message-Id: <4kekuvFbsiotU1@news.dfncis.de>
Ted Zlatanov <tzz@lifelogs.com> wrote in comp.lang.perl.misc:
> On 14 Aug 2006, anno4000@radom.zrz.tu-berlin.de wrote:
[snip]
> Those are excellent points, Anno. In my experience map() and grep()
> are very difficult for beginners, ...
[...]
> Sadly, my second example in the article uses map() for the side
> effect. The shame!
You are in very good company there. Abigail will defend everyone's
right to use map() in void context. Also, AFAIK Tassilo's patch
is in place, which suppresses the building of a list in scalar and
void context.
> Anyhow, I'm just saying that I do agree with you, but think it's good
> to either comment well or consider a simpler approach when you're
> putting together FP and a beginner :)
There have been courses for beginning programmers taught in Lisp,
so it can't be impossible. (I have no idea how successful these
courses were.)
Anyway, on clpm I don't necessarily post with an audience of beginners
in mind. Even if a majority of potential readers are beginners, the
highly significant minority of regulars (including regular lurkers)
are not. Clpm gives me the echo (or lack thereof) of programmers whose
skill I know. Selfishly, I want it to my original solution, not some
toned-down version in usum infanti.
I also value the comments by beginners to advanced code. The best
are, of course, of the "Please explain" nature. No, wrong, the best
ones would be "Oh, that's how it's done", but then people understandably
often move on without posting. "Please explain" means someone wants
to learn, which is good. Often I find someone else has given an
excellent explanation when I come back, which is also good :) Even
bad-tempered or hostile replies show me I have overstepped someone's
limit, not that I necessarily care.
So I think that posting advanced code serves a useful purpose in the
group, even if it is over the head of parts of the audience. As they
say, there's always the "n" key...
Anno
------------------------------
Date: 15 Aug 2006 12:23:16 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: perl dbi driver for microsoft sql?
Message-Id: <1155669795.913577.74920@74g2000cwt.googlegroups.com>
gavino wrote:
> where do i find dbi driver for micrsoft sql?
The same place you find all Perl Modules - http://search.cpan.org
Is
http://search.cpan.org/~jwied/Msql-Mysql-modules-1.2219/mysql/lib/DBD/mysql.pm
what you're looking for?
Paul Lalli
------------------------------
Date: Tue, 15 Aug 2006 16:15:18 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: perl dbi driver for microsoft sql?
Message-Id: <m2ejvh4uy1.fsf@Sherm-Pendleys-Computer.local>
"Paul Lalli" <mritty@gmail.com> writes:
> gavino wrote:
>> where do i find dbi driver for micrsoft sql?
>
> The same place you find all Perl Modules - http://search.cpan.org
Quite right.
> Is
> http://search.cpan.org/~jwied/Msql-Mysql-modules-1.2219/mysql/lib/DBD/mysql.pm
> what you're looking for?
Actually, no. mSQL is not Microsoft SQL Server, it's a different product:
<http://www.hughes.com.au/products/msql/>
I couldn't find a MS-SQL specific DBD module - I think most people use
DBD::ODBC.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: 15 Aug 2006 13:21:42 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: perl dbi driver for microsoft sql?
Message-Id: <1155673302.242214.60640@h48g2000cwc.googlegroups.com>
Sherm Pendley wrote:
> "Paul Lalli" <mritty@gmail.com> writes:
>
> > gavino wrote:
> >> where do i find dbi driver for micrsoft sql?
>
> > Is
> > http://search.cpan.org/~jwied/Msql-Mysql-modules-1.2219/mysql/lib/DBD/mysql.pm
> > what you're looking for?
>
> Actually, no. mSQL is not Microsoft SQL Server, it's a different product:
>
> <http://www.hughes.com.au/products/msql/>
Whoops. Sorry about that. Thanks for the catch, Sherm.
Paul Lalli
------------------------------
Date: 15 Aug 2006 13:41:19 -0700
From: "MarkRat" <markrat@gmail.com>
Subject: Re: perl dbi driver for microsoft sql?
Message-Id: <1155674479.082506.98610@p79g2000cwp.googlegroups.com>
Sherm Pendley wrote:
> "Paul Lalli" <mritty@gmail.com> writes:
>
> > gavino wrote:
> >> where do i find dbi driver for micrsoft sql?
> >
> > The same place you find all Perl Modules - http://search.cpan.org
>
> Quite right.
>
> > Is
> > http://search.cpan.org/~jwied/Msql-Mysql-modules-1.2219/mysql/lib/DBD/mysql.pm
> > what you're looking for?
>
> Actually, no. mSQL is not Microsoft SQL Server, it's a different product:
>
> <http://www.hughes.com.au/products/msql/>
>
> I couldn't find a MS-SQL specific DBD module - I think most people use
> DBD::ODBC.
>
You can also use DBD::ADO or DBD::Sybase to connect to MS SQL databases.
------------------------------
Date: 15 Aug 2006 21:44:06 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Proposal: extending perldoc -f
Message-Id: <ao84e2lruebrscdbm0pm2qosanqrrucgh7@4ax.com>
On Tue, 15 Aug 2006 17:14:59 +0000 (UTC), Ilya Zakharevich
<nospam-abuse@ilyaz.org> wrote:
>> IMHO, EACH AND EVERY Perl keyword should resolve by "perodoc -f" even
>> if it simply points to a more relevant perldoc (as you, Michelle,
>> wisely imply).
>
>Why do it halfway? IMO, `perldoc -f' should show the docs, not
>pointers to docs.
Well, if -f is to remain bound at least in principle to functions,
then the brief pointers would be ok. Else there's the proposed -k for
"keyword" about which I read in another post in this thread. But then
I suppose that people would start using -k instead of -f for quite
about everything, so eventually two switches could be redundant. Thus
I see no problem if a suitably extended -f survived, being linked to
the letter "f" only for historical reasons, but practically serving
the purpose of providing help on specific keywords.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Tue, 15 Aug 2006 13:22:17 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Proposal: extending perldoc -f
Message-Id: <150820061322175199%jgibson@mail.arc.nasa.gov>
In article <ao84e2lruebrscdbm0pm2qosanqrrucgh7@4ax.com>, Michele Dondi
<bik.mido@tiscalinet.it> wrote:
> On Tue, 15 Aug 2006 17:14:59 +0000 (UTC), Ilya Zakharevich
> <nospam-abuse@ilyaz.org> wrote:
>
> >> IMHO, EACH AND EVERY Perl keyword should resolve by "perodoc -f" even
> >> if it simply points to a more relevant perldoc (as you, Michelle,
> >> wisely imply).
> >
> >Why do it halfway? IMO, `perldoc -f' should show the docs, not
> >pointers to docs.
>
> Well, if -f is to remain bound at least in principle to functions,
> then the brief pointers would be ok. Else there's the proposed -k for
> "keyword" about which I read in another post in this thread. But then
> I suppose that people would start using -k instead of -f for quite
> about everything, so eventually two switches could be redundant. Thus
> I see no problem if a suitably extended -f survived, being linked to
> the letter "f" only for historical reasons, but practically serving
> the purpose of providing help on specific keywords.
Why not dispense with the option altogether? Why shouldn't I be able to
type:
perldoc grep
perldoc while
perldoc strict
perldoc CGI
and get the appropriate section. Are there any duplicates between
keywords, built-in functions, and modules? If there are, perldoc could
print them out and require me to re-enter the command with '-k', '-f',
or maybe '-m' (which is currently used to display a module in its
entirety) flags.
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: 15 Aug 2006 13:28:20 -0700
From: lmcosorio@hotmail.com
Subject: Regex Help
Message-Id: <1155673700.258527.248250@i3g2000cwc.googlegroups.com>
Hi Everyone,
I've been learning Perl for about 6 months. This is my first post to
the group as it's also the first time i couldn't find an answer on this
group or elsewhere.
Here's my problem. I want to match a line from a file with the
following conditions:
1 - It starts with aaa?
2 - Has random characthers following the "?"
3 - ends with s=196
1 & 2 are variables.
Below is a sample script a wrote that shows (almost) what i need. I use
the \Q modifier because of the "?" on the 1st variable.
I can't seem to figure out how to match randoms characters between
$var1 and $var2. To make things harder (at least for me) the randoms
characters can contain special regex characters.
use strict;
use warnings;
my $match1='aaa?';
my $match2='s=196';
my $var='aaa?s=196';
if ($var =~ /\Q$match1$match2/)
{
print "It matched...";
}
where i have:
if ($var =~ /\Q$match1$match2/)
i need to have
if ($var =~ /\Q$match1[match any random characters]$match2/)
Any help apreciated.
I hope my question is understandable and please forgive my english.
Regards,
Luis
------------------------------
Date: Tue, 15 Aug 2006 20:58:21 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Regex Help
Message-Id: <Xns9820ACC097A86asu1cornelledu@127.0.0.1>
lmcosorio@hotmail.com wrote in news:1155673700.258527.248250
@i3g2000cwc.googlegroups.com:
> Here's my problem. I want to match a line from a file with the
> following conditions:
The posting guidelines for this group describe the recommended way of
including some sample data. Doing so reduces any guesswork involved.
> 1 - It starts with aaa?
> 2 - Has random characthers following the "?"
> 3 - ends with s=196
>
> 1 & 2 are variables.
>
> Below is a sample script a wrote that shows (almost) what i need. I
> use the \Q modifier because of the "?" on the 1st variable.
> I can't seem to figure out how to match randoms characters between
> $var1 and $var2. To make things harder (at least for me) the randoms
> characters can contain special regex characters.
I would recommend using meaningful variable names, and using them
consistently. Here you talk about $var1 and $var2, below your code
refers to $match1 and $match2. Neither are good names in that they do
not describe what the intended use is.
> use strict;
> use warnings;
Good. Thank you very much.
> my $match1='aaa?';
> my $match2='s=196';
> my $var='aaa?s=196';
In your description above, you said there were supposed to be some
characters between the start and end markers. Here, there is nothing.
>
> if ($var =~ /\Q$match1$match2/)
> {
> print "It matched...";
> }
>
>
> where i have:
> if ($var =~ /\Q$match1$match2/)
>
> i need to have
>
> if ($var =~ /\Q$match1[match any random characters]$match2/)
You don't mention if there might be a newline in there.
Here is something that might be what you are after:
#!/usr/bin/perl
use strict;
use warnings;
my $start = 'aaa?';
my $end = 's=196';
while ( my $str = <DATA> ) {
if ( $str =~ /\A \Q$start\E (.+) \Q$end\E \n? \z/sox ) {
print "$1\n";
}
}
__DATA__
aaa?sdfkjsdlkfjbnbbnbnbc\\\//@[]?*$1\2s=196
D:\UseNet\clpmisc> t64
sdfkjsdlkfjbnbbnbnbc\\\//@[]?*$1\2
The 's' option in the match above ensures that (.+) captures any text,
including newlines, between the $start and $end markers.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Tue, 15 Aug 2006 18:22:39 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: UK Recruitment for Junior Perl Developer
Message-Id: <slrnee447f.g0j.dha@panix2.panix.com>
On 2006-08-14, Allan <allan.wroe@mayfieldcurzon.com> wrote:
> Ladies and Gents. I am a Recruitment Consultant currently engaged by a
> client in North Yorkshire (Harrogate) to find 2 junior Perl Developers.
You have posted a job posting or a resume in a technical group.
Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.
Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :) (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).
Please do not explain your posting by saying "but I saw other job
postings here". Just because one person jumps off a bridge, doesn't
mean everyone does. Those postings are also in error, and I've
probably already notified them as well.
If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.
http://jobs.perl.org may be of more use to you
Yours for a better usenet,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"Look, vultures! My dress is made of steaks!"
- Allison Drennan
------------------------------
Date: 15 Aug 2006 12:51:26 -0700
From: Zyad.Tamimi@gmail.com
Subject: Re: Website Interface
Message-Id: <1155671486.901831.231340@m73g2000cwd.googlegroups.com>
thanks for the timely feedback, I'll try it out and let you know how it
turns out. thanks again.
Regards,
Zyad
usenet@DavidFilmer.com wrote:
> Zyad.Tamimi@gmail.com wrote:
> > I have a list of names and what I am attempting to do is connect to a
> > website and search for all the names in the websites directory. Is
> > there a simple module in CPAN that can help me do this?
>
> Maybe so... People try to do this to my webserver all the time ;-)
>
> Of course, any halfway-configured webserver won't let it happen (and
> there's nothing you can do about it, prehaps short of some type of
> exploit).
>
> Actually, CPAN has very few programs - it has lots of modules which are
> used to build programs. If you think you can go to CPAN and download a
> functional program to do something then you are mistaken about how CPAN
> really works.
>
> If you can do what you want to do from a browser, you can (probably)
> use WWW::Mechanize to do it in Perl. If the webserver is so poorly
> configured that it will reveal its directory and file structure (say,
> by omitting the name of the index document) then you can easily slurp
> that info. But otherwise, forget it.
>
> --
> David Filmer (http://DavidFilmer.com)
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 9609
***************************************