[25181] in Perl-Users-Digest
Perl-Users Digest, Issue: 7430 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 20 11:06:03 2004
Date: Sat, 20 Nov 2004 08:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 20 Nov 2004 Volume: 10 Number: 7430
Today's topics:
Re: Bits of a number... why is this true? <uri@stemsystems.com>
Re: Bits of a number... why is this true? <kalinaubears@iinet.net.au>
Re: Bits of a number... why is this true? <joe@inwap.com>
Re: Bits of a number... why is this true? (Peter Scott)
Re: Can PERL open a Windows handle? <kalinaubears@iinet.net.au>
Command-line HTML Post-method (medline in lynx) vjp2.at@at.BioStrategist.dot.dot.com
Re: Command-line HTML Post-method (medline in lynx) <matthew.garrish@sympatico.ca>
Re: Complex datastructure documentation? <uri@stemsystems.com>
Re: Complex datastructure documentation? <postmaster@castleamber.com>
Re: cookies vs. hidden fields <spamtrap@dot-app.org>
Re: Easier web programming language: PERL or PHP? <amead@comcast.net>
Re: Easier web programming language: PERL or PHP? <spamtrap@dot-app.org>
Re: Easier web programming language: PERL or PHP? <bik.mido@tiscalinet.it>
FAQ 4.51: How do I permute N elements of a list? <comdog@panix.com>
how *.cgi file can get the parameters from client? <end@dream.life>
Re: how *.cgi file can get the parameters from client? <spamtrap@dot-app.org>
Re: how *.cgi file can get the parameters from client? <end@dream.life>
Ignore spaces in string match <thelma@alpha2.csd.uwm.edu>
Re: Ignore spaces in string match <postmaster@localhost.localdomain>
keep the reference pointer of an object <sam.wun@authtec.net>
OT irregardless (was Re: Problem with Hashes) <tadmc@augustmail.com>
Re: Problem with Hashes <tassilo.von.parseval@rwth-aachen.de>
Re: Problem with Hashes <nospam@nospam.com>
Re: Problem with Hashes <nospam@nospam.com>
Re: Search for string and return file name <misc@actitud.NOSPAM.se>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 20 Nov 2004 05:18:03 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Bits of a number... why is this true?
Message-Id: <x7actdxfn8.fsf@mail.sysarch.com>
>>>>> "TM" == Tad McClellan <tadmc@augustmail.com> writes:
TM> Uri Guttman <uri@stemsystems.com> wrote:
>>>>>>> "nwcn" == news west cox net <sean.berry2@cox.net> writes:
>> bah! first off, if you are going to use bit fields, DON'T USE DECIMAL
TM> ^^^^^^^^^^^^^^^^^
>> VALUES!!
TM> ^^^^^^
TM> Your shift key doesn't work, but your caps lock key does?
TM> You need to upgrade your keyboard man...
i never use caps lock. i just lean on shift when i yell :).
>> use hex (0x) octal or even binary (0b). perl supports them all.
TM> Bah! Ignore Uri this time.
ignore me all the time, please!
TM> 0x0A hex
TM> 10 decimal
TM> 012 octal
TM> 1010 binary
TM> Those are all *the same* value, just different representations
TM> for that value.
TM> Uri must have meant "don't use decimal representations" instead.
yeah. just seeing decimals used for large binary flags is so fugly.
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: Sat, 20 Nov 2004 08:34:58 +0000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: Bits of a number... why is this true?
Message-Id: <419f111d$0$25765$5a62ac22@per-qv1-newsreader-01.iinet.net.au>
news.west.cox.net wrote:
> Forgive my possible ignorance to a seemingly easy question...
>
> Why does this return true?
>
> $num = 24465973248
> if ($num & 131072) {
> do something...
> }
>
> The 18th bit of the binary representation of $num is off.
>
>
Fwiw the following will work for numbers of *any* size - limited only by
your machine's memory capabilities.
use warnings;
use Math::BigInt;
my $x = Math::BigInt->new('24465973248');
my $y = Math::BigInt->new('131072');
print $x & $y, "\n";
__END__
For really big numbers you would switch to using Math::GMP, or
Math::PARI, or Bit::Vector - as Math::BigInt becomes a little slow.
Cheers,
Rob
--
To reply by email u have to take out the u in kalinaubears.
------------------------------
Date: Sat, 20 Nov 2004 10:28:45 GMT
From: Joe Smith <joe@inwap.com>
Subject: Re: Bits of a number... why is this true?
Message-Id: <x%End.539245$mD.313708@attbi_s02>
news.west.cox.net wrote:
> I do not know how many bits can go in a perl number.
You should do some simple tests to find the number of bits
for the particular version of perl you are using.
linux% cat test.pl
$num = 24465973248;
$bit18 = 131072;
printf "%15.2f = 0x%09x = 0xb%036b\n",$_,$_,$_ for
($num,$bit18,$num&$bit18);
linux% perl test.pl
24465973248.00 = 0x0ffffffff = 0xb000011111111111111111111111111111111
131072.00 = 0x000020000 = 0xb000000000000000000100000000000000000
131072.00 = 0x000020000 = 0xb000000000000000000100000000000000000
Now try it on a system using a CPU that is wider than 32 bits.
tops20@ type test.pl
$num = 24465973248;
$bit18 = 131072;
for ($num, $bit18, $num&$bit18) {
printf "%15.2f = 0x%09x = 0xb%036b\n",$_,$_,$_ ;
}
tops20@ perl test.pl
24465973248.00 = 0x5b2492000 = 0xb(printf: 'b'?)
131072.00 = 0x000020000 = 0xb(printf: 'b'?)
0.00 = 0x000000000 = 0xb(printf: 'b'?)
-Joe
--
36-bits forever! http://www.inwap.com/pdp10/
------------------------------
Date: Sat, 20 Nov 2004 15:21:23 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Bits of a number... why is this true?
Message-Id: <ThJnd.278686$Pl.235490@pd7tw1no>
In article <x7wtwhz9dh.fsf@mail.sysarch.com>,
Uri Guttman <uri@stemsystems.com> writes:
>>>>>> "nwcn" == news west cox net <sean.berry2@cox.net> writes:
> nwcn> I understand what you are saying. But, is there a way that I
> nwcn> can still accomplish my original goal.
>
>even so, you should learn more about binary representation.
>
>as for how many bits in a perl number, that is trivial to find and you
>don't need google. try perl -v
Sometimes you need to use the shift key :-) For the benefit of
anyone who couldn't tell, that should be perl -V.
--
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/
------------------------------
Date: Sat, 20 Nov 2004 09:04:35 +0000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: Can PERL open a Windows handle?
Message-Id: <419f180e$0$25784$5a62ac22@per-qv1-newsreader-01.iinet.net.au>
Paul S. wrote:
> Hi,
> Can PERL open a Windows Handle?
In addition to the other answers, it's also fairly straightforward to
wrap (many of) the Windows API functions using Inline::C. But you need a
C compiler for that.
> Where would I go to see how to do it?
>
perldoc Inline::C-Cookbook
though the example there doesn't actually wrap a function that returns a
handle.
Cheers,
Rob
--
To reply by email u have to take out the u in kalinaubears.
------------------------------
Date: Sat, 20 Nov 2004 10:44:33 +0000 (UTC)
From: vjp2.at@at.BioStrategist.dot.dot.com
Subject: Command-line HTML Post-method (medline in lynx)
Message-Id: <cnn76h$551$1@reader1.panix.com>
I am trying to write a unix proc that will pass my search terms to
a search engine that uses post-method. I don't really understand how
post works. Below is my attempt (I manually wrapped the one line proc
into sep lines for display purposes):
medline () { SRCH=`echo $* | sed -e 's/ /+/g'`; lynx -post_data
-accept_all_cookies 'http://www.ncbi.nlm.nih.gov/htbin-post
/Entrez/query_old?form=4&title=no&term='$SRCH'&submit=Search
&field=All+++++++++++++++++++Fields&mode=Automatic&relpubdate
=No+Limit&dispmax=100+&Dopt=d';}
Much obliged in advance for any help.
- = -
Vasos-Peter John Panagiotopoulos II, Columbia'81+, Bio$trategist
BachMozart ReaganQuayle EvrytanoKastorian
http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Health Reform means abolishing FDR's insurance tax exemption]
[To stop SPAM, Charge net-postage] [Abolish 16th (Inc Tx) Amendment]
------------------------------
Date: Sat, 20 Nov 2004 10:17:21 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Command-line HTML Post-method (medline in lynx)
Message-Id: <2eJnd.36782$rc.2313167@news20.bellglobal.com>
<vjp2.at@at.BioStrategist.dot.dot.com> wrote in message
news:cnn76h$551$1@reader1.panix.com...
> I am trying to write a unix proc that will pass my search terms to
> a search engine that uses post-method. I don't really understand how
> post works. Below is my attempt (I manually wrapped the one line proc
> into sep lines for display purposes):
>
Since you crossposted to a Perl newsgroup:
http://search.cpan.org/~gaas/libwww-perl-5.801/lwpcook.pod#POST
Matt
------------------------------
Date: Sat, 20 Nov 2004 05:16:33 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Complex datastructure documentation?
Message-Id: <x7d5y9xfpq.fsf@mail.sysarch.com>
>>>>> "JB" == John Bokma <postmaster@castleamber.com> writes:
JB> Bernard El-Hagin wrote:
>> I can't believe how asinine this thread has become. You know very well
>> what Uri means by his statements and that he is right.
JB> Uri was just trying to get a point across by claiming I don't know
JB> shit about OO(D). He used quite a creative way of cutting away my
JB> examples (hence ignoring them), and also commented on the wrong
JB> ones. His main argument seemed to be: You don't understand, you
JB> got it all wrong. Flavoured with some meta-blah blah.
JB> My original statement: An OO way of accessing a complex data
JB> structure v.s. munging it all over the place in your code still
JB> holds, is valid, and in my not so humble opinion correct.
you still don't get it. bad code can be hidden all you want but it is
still bad code.
JB> Uri's: you can write shit both ways, sure. But I assume a skilled
JB> coder, not someone who can't distinguish a hash from an array.
we are assuming the OP. do you remember how this thread started? he
posted horrible data structure access code. hiding THAT code behind OO
doesn't make it better code. simple. it is bad code. period. it has
nothing to do with his design but with his bad code to access it.
OO is not coding. coding is not OO. they are orthogonal. look up that
word please. it is so simple a concept but you keep saying OO can cure
it. OO can not cure bad code. at best it can hide it. bad code needs to
be rewritten as good code regardless of the design paradigm.
i don't know why you don't get this already. it has nothing to do with
OO or design. the OP POSTED BAD CODE. simple. i rewrote it. simple. i
didn't need OO as it wasn't in play. simple. OO had nothing to do with
it and would not have fixed his bad code. simple.
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: 20 Nov 2004 15:54:46 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Complex datastructure documentation?
Message-Id: <Xns95A764D61B00Dcastleamber@130.133.1.4>
Uri Guttman wrote:
>>>>>> "JB" == John Bokma <postmaster@castleamber.com> writes:
>
> JB> Bernard El-Hagin wrote:
> >> I can't believe how asinine this thread has become. You know very
> >> well what Uri means by his statements and that he is right.
>
> JB> Uri was just trying to get a point across by claiming I don't
> know JB> shit about OO(D). He used quite a creative way of cutting
> away my JB> examples (hence ignoring them), and also commented on
> the wrong JB> ones. His main argument seemed to be: You don't
> understand, you JB> got it all wrong. Flavoured with some meta-blah
> blah.
>
> JB> My original statement: An OO way of accessing a complex data
> JB> structure v.s. munging it all over the place in your code still
> JB> holds, is valid, and in my not so humble opinion correct.
>
> you still don't get it. bad code can be hidden all you want but it is
> still bad code.
Of course I don't get it, because that's the way you want to read it
Uri. Maybe come back down to Earth, and do an attempt to decipher my
writings.
Bottom line: where do you want to have your bad code? In one central
place, or all over the place?
> JB> Uri's: you can write shit both ways, sure. But I assume a
> skilled JB> coder, not someone who can't distinguish a hash from an
> array.
>
> we are assuming the OP. do you remember how this thread started? he
> posted horrible data structure access code. hiding THAT code behind OO
> doesn't make it better code. simple. it is bad code. period. it has
> nothing to do with his design but with his bad code to access it.
Does that mean that the OP is not able to learn OO? Maybe your first
Perl scripts were clear and beautiful designed? Mine weren't, and no, I
don't blame Perl 4 for that :-D.
> OO is not coding. coding is not OO. they are orthogonal.
Yada Yada. Read what others wrote if you don't believe me. There is not
one holy OO. You are talking about OO design.
Tell me, do you name your classes and methods in your OO design?
> look up that word please.
Again you do an attempt to "win" a discussion by doubting my skills.
It's clear that *you* have to look up OO.
> it is so simple a concept but you keep saying OO can cure
> it. OO can not cure bad code.
Again, I never wrote it. OO can make code more readable, code that uses
excesive access to very complex datastructures. But probably you are
going to quote me bad again, and yell again that I don't understand OO.
It doesn't make it true Uri, it only makes you look like a fool. At
least to me.
> at best it can hide it. bad code needs
> to be rewritten as good code regardless of the design paradigm.
Sometimes bad code becomes better when one studies a bit more. If you
use complex datastructures, reading about OO can enhance ones coding
skills. OO is about combining data and functions working on that data in
a nice self-contained package.
> i don't know why you don't get this already.
Because you don't want me to get it.
> it has nothing to do with
> OO or design. the OP POSTED BAD CODE. simple.
Yell yell. Oh, Uri, before delving deeper into OO, learn that a sentence
often starts with a capital, or in Perl:
ucfirst ($Uri_sentence);
> i rewrote it. simple. i
> didn't need OO as it wasn't in play. simple. OO had nothing to do with
> it and would not have fixed his bad code. simple.
OO will make your rewritten code more readable, since the OP is going to
use that complex datastructure in several places in his code.
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Sat, 20 Nov 2004 01:00:44 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: cookies vs. hidden fields
Message-Id: <3ZSdndQ3Rc34QAPcRVn-rA@adelphia.com>
daniel kaplan wrote:
> "Sherm Pendley" <spamtrap@dot-app.org> wrote in message
> news:xdadndRcVdMH7APcRVn-qw@adelphia.com...
>
>>Having said that, all other things being equal, I'd use hidden fields.
>>Cookie support is optional, a cookie file can be deleted by a user, etc.
>>They're just not as reliable.
>>
>>Although, hidden fields aren't particularly reliable either... They're
>>easy to fake with LWP or WWW::Mechanize, for instance. (Which is the
>>best I could do to bring *some* semblance of Perl into this answer. :-)
>>
>
> thanks? i think? no seriously, your answer would suggest to me i could go
> either way, without there being one major flaw that one has over the other
Like I said, all other things being equal, I'd say that hidden fields
have a slight edge, in that cookies can be (and often are) disabled by
end users.
The rest was just caveats - hidden fields have their own drawbacks,
flaws, and trade-offs, so I don't regard them as a "good" solution,
simply the "least bad" solution.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Fri, 19 Nov 2004 23:08:47 -0600
From: Alan Mead <amead@comcast.net>
Subject: Re: Easier web programming language: PERL or PHP?
Message-Id: <pan.2004.11.20.05.08.46.472762@comcast.net>
On Sat, 20 Nov 2004 01:51:22 +0100, Marta wrote:
> I would to study a web programming language to create a script that,
> given
Perl would be the best choice here because it was designed with postage
and packaging in mind. (That's what the 'P' in Perl stands for).
Here are a couple websites to get you started:
http://stein.cshl.org/WWW/software/CGI/
http://stein.cshl.org/WWW/software/CGI/examples/
Lincoln Stein (CGI.pm author) has an easy-to-read book and I recommend it
highly. The book discusses the examples from the second link.
-Alan
------------------------------
Date: Sat, 20 Nov 2004 00:36:46 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Easier web programming language: PERL or PHP?
Message-Id: <yridnTZPbqlVSgPcRVn-iw@adelphia.com>
Tad McClellan wrote:
> Marta <marta@mariapia.com> wrote:
>
>>ASP is much more complicated?
>
> Proprietary stuff sucks big ones.
I don't know if I'd characterize ASP as entirely proprietary. There's an
Apache::ASP module that you can use with mod_perl that uses the same
embedding syntax, very similar request, session, and response objects, etc.
Also, if you're using ActiveState's Perl distro, it includes integration
with Windows scripting, so you can use Perl in ASP there as well.
Of course, proprietary or not, ASP is still content, logic, and
presentation all rolled up together into one big hairy nasty mess of
total suckage.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sat, 20 Nov 2004 14:15:30 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Easier web programming language: PERL or PHP?
Message-Id: <gngup0p6cgueh6haabboqf3k6ttvbm22h4@4ax.com>
On Fri, 19 Nov 2004 23:08:47 -0600, Alan Mead <amead@comcast.net>
wrote:
>Perl would be the best choice here because it was designed with postage
>and packaging in mind. (That's what the 'P' in Perl stands for).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Huh?!? Where did you hear that?
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: Sat, 20 Nov 2004 11:03:02 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 4.51: How do I permute N elements of a list?
Message-Id: <cnn896$5d3$1@reader1.panix.com>
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 Perl.
--------------------------------------------------------------------
4.51: How do I permute N elements of a list?
Use the List::Permutor module on CPAN. If the list is actually an array,
try the Algorithm::Permute module (also on CPAN). It's written in XS
code and is very efficient.
use Algorithm::Permute;
my @array = 'a'..'d';
my $p_iterator = Algorithm::Permute->new ( \@array );
while (my @perm = $p_iterator->next) {
print "next permutation: (@perm)\n";
}
For even faster execution, you could do:
use Algorithm::Permute;
my @array = 'a'..'d';
Algorithm::Permute::permute {
print "next permutation: (@array)\n";
} @array;
Here's a little program that generates all permutations of all the words
on each line of input. The algorithm embodied in the permute() function
is discussed in Volume 4 (still unpublished) of Knuth's *The Art of
Computer Programming* and will work on any list:
#!/usr/bin/perl -n
# Fischer-Kause ordered permutation generator
sub permute (&@) {
my $code = shift;
my @idx = 0..$#_;
while ( $code->(@_[@idx]) ) {
my $p = $#idx;
--$p while $idx[$p-1] > $idx[$p];
my $q = $p or return;
push @idx, reverse splice @idx, $p;
++$q while $idx[$p-1] > $idx[$q];
@idx[$p-1,$q]=@idx[$q,$p-1];
}
}
permute {print"@_\n"} split;
--------------------------------------------------------------------
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-2002 Tom Christiansen and Nathan
Torkington, and other contributors as noted. All rights
reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
------------------------------
Date: Sat, 20 Nov 2004 19:08:57 +0800
From: Alont <end@dream.life>
Subject: how *.cgi file can get the parameters from client?
Message-Id: <419f2180.40225859@news.individual.de>
how I can get the parameter from client through in Perl script?
I can't find it in CGI:: module,
--
Your fault as a Government is My failure as a Citizen.
------------------------------
Date: Sat, 20 Nov 2004 06:25:24 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: how *.cgi file can get the parameters from client?
Message-Id: <CemdnWRVaZ_gtALcRVn-sw@adelphia.com>
Alont wrote:
> how I can get the parameter from client through in Perl script?
> I can't find it in CGI:: module,
Are you serious? You read through the module docs, and somehow you
managed to miss both the example at the top, and the section titled
"FETCHING THE VALUE OR VALUES OF A SINGLE NAMED PARAMETER"?
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sat, 20 Nov 2004 20:05:26 +0800
From: Alont <end@dream.life>
Subject: Re: how *.cgi file can get the parameters from client?
Message-Id: <419f32ad.44623562@news.individual.de>
ʱ¼ä:Sat, 20 Nov 2004 06:25:24 -0500
Sherm Pendley <spamtrap@dot-app.org>ÔøÓ÷¢ÑÔ:--
>
>Are you serious? You read through the module docs, and somehow you
>managed to miss both the example at the top, and the section titled
>"FETCHING THE VALUE OR VALUES OF A SINGLE NAMED PARAMETER"?
>
>sherm--
I'm sorry, I search the CGI folder, but lost CGI.html..........
--
Your fault as a Government is My failure as a Citizen.
------------------------------
Date: 20 Nov 2004 14:50:39 GMT
From: Thelma Lubkin <thelma@alpha2.csd.uwm.edu>
Subject: Ignore spaces in string match
Message-Id: <cnnljv$r34$1@uwm.edu>
I am trying to compare two strings that must match except for their
spacing.
If I write:
$h1 = 'here i am';
$h2 = 'herei am';
can I do a less clumsy comparison than
($hh2 = $h2) =~ s/\s//x;
if($hh2 =~ /^$h1$/x) ...
--thanks, thelma
------------------------------
Date: Sat, 20 Nov 2004 15:04:01 +0000
From: bengee <postmaster@localhost.localdomain>
Subject: Re: Ignore spaces in string match
Message-Id: <419f5c91$0$33604$ed2619ec@ptn-nntp-reader02.plus.net>
Thelma Lubkin wrote:
> I am trying to compare two strings that must match except for their
> spacing.
Remove spaces from both strings... if they match then they match!
bengee
------------------------------
Date: Sat, 20 Nov 2004 22:02:24 +0800
From: sam <sam.wun@authtec.net>
Subject: keep the reference pointer of an object
Message-Id: <cnnkb2$c7p$1@news.hgc.com.hk>
Hi,
I would like to do something like C in Perl. Sorry, I m not expert in Perl.
I m writng a webmin module that manage the Cyrus email accounts.
But every time when need to change the Cyrus user account info, I need
to use the Cyrus::IMAP::Admin->new() method login Cyrus first.
How can I login Cyrus once and keep its returned reference for another
.cgi file used? (I won't keep plaintext password in perl or
configuration file either, so if imap is not login by Cyrus admin, user
need to login Cyrus admin account first).
For example, if I have already invoked $imap = &imap_connect() in the
index.cgi file, another cgi file (set_quota.cgi) no need to call the
method imap_connect() again, instead, it will somehow use the reference
of imap created in the index.cgi file and just call $imap->setquota().
Not sure if use Global declaration is a good idea. I don't want this
reference to be "boardcast". I found command ENV is a way to get the
value of the enviornment variable, but don't think this is a secure way
to get the reference of the object in this case.
Thanks
Sam.
------------------------------
Date: Sat, 20 Nov 2004 01:47:44 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: OT irregardless (was Re: Problem with Hashes)
Message-Id: <slrncpttl0.aas.tadmc@magna.augustmail.com>
Tassilo v. Parseval <tassilo.von.parseval@rwth-aachen.de> wrote:
[snip]
> irregardless how much sense that makes.
Hmmm, lessee...
"regardless" would mean "without regard", so "irregardless" must
mean "not without regard", ie. *with* regard! [1]
Sorry... you just hit one of my three "hot buttons" there.[2] :-)
[1] Though it is so commonly (mis)used that I wouldn't be surprised
if some dictionaries treat it as if it really was a word.
[2] The other two being: the use of "literal" for emphasis when
it is clearly *not* literal but figurative (e.g. He literally
laughed his head off) and using i.e. when they mean e.g.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 20 Nov 2004 07:36:15 +0100
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: Problem with Hashes
Message-Id: <slrncptpev.ri.tassilo.von.parseval@localhost.localdomain>
Also sprach Jürgen Exner:
> daniel kaplan wrote:
>> i have to admit, in the past few weeks am totally pleased and
>> impressed with how much you can do with Perl by typing so
>> little.....but here is where i miss some of the strictness of C....
>
> You must be kidding. Since when does C have strict typing?
It has static typing...which could be called strict if there weren't
those casting operators that can be used to morph one type into any
other type, irregardless how much sense that makes.
> C doesn't even have a data type for text.
That certainly has nothing to do with typing. It would imply that C++ is
more strictly typed than C just because it has the 'string' datatype.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Sat, 20 Nov 2004 08:27:28 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Problem with Hashes
Message-Id: <1100957333.586632@nntp.acecape.com>
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:qOvnd.683$0k1.517@trnddc08...
> You must be kidding. Since when does C have strict typing?
> C doesn't even have a data type for text.
int c[2];
c[0] = c[1] = 1;
MyFunc (&c); //pass the address of C, a reference in Perl
void MyFunc (int *pInt)
{
int a;
a = pInt;
now the compiler won't come out and smack you in the face, but it will
hiccup withat least one or two wanrings....
that's what i meant by strict...in Perl, it's valid in that a woudl be
equalt to 2....
------------------------------
Date: Sat, 20 Nov 2004 08:37:45 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Problem with Hashes
Message-Id: <1100957950.188815@nntp.acecape.com>
"daniel kaplan" <nospam@nospam.com> wrote in message
news:1100957333.586632@nntp.acecape.com...
> void MyFunc (int *pInt)
> {
> int a;
>
> a = pInt;
>
>
> now the compiler won't come out and smack you in the face, but it will
> hiccup withat least one or two wanrings....
>
> that's what i meant by strict...in Perl, it's valid in that a woudl be
> equalt to 2....
mind you , not as typed above, but you get my point
------------------------------
Date: Sat, 20 Nov 2004 12:51:46 GMT
From: =?ISO-8859-1?Q?=D6rjan_Johansson?= <misc@actitud.NOSPAM.se>
Subject: Re: Search for string and return file name
Message-Id: <C5Hnd.9135$d5.79762@newsb.telia.net>
Örjan Johansson wrote:
> Hi all!
>
> I'm trying to figure out how to go through all files with a certain
> extension in a directory, search for a string and return the names of the
> files that contains the string. I have written scripts before that opens a
> single file for reading and writing, but have no clue how to go through all
> files in a folder, like a wildcard *.log kind of thing. Any pointers?
>
> TIA,
> Örjan
>
>
Thanx all you guys. Just like I suspected, there are tons of ways to
achieve everything. I've got several ideas to work with now. Thanks
again everyone for your input!
Sincerely,
Örjan
------------------------------
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 7430
***************************************