[22505] in Perl-Users-Digest
Perl-Users Digest, Issue: 4726 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 18 18:05:49 2003
Date: Tue, 18 Mar 2003 15:05:13 -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 Tue, 18 Mar 2003 Volume: 10 Number: 4726
Today's topics:
Re: Adding Perl library to default OS X Server install (Anno Siegel)
Re: Anyone For Golf? (Resistor Colour Codes) (Anno Siegel)
Array reference argument to subroutine problem (Jim Cochrane)
Re: Array reference argument to subroutine problem <uri@stemsystems.com>
Re: Array reference argument to subroutine problem <me@verizon.invalid>
Re: Array reference argument to subroutine problem <perl-dvd@darklaser.com>
Re: Array reference argument to subroutine problem (Jim Cochrane)
Re: Array reference argument to subroutine problem (Jim Cochrane)
Re: Can I use session Variables in Perl <pkent77tea@yahoo.com.tea>
Re: Determining String Membership (Walter Roberson)
Re: Determining String Membership <noreply@gunnar.cc>
Re: disable pattern metacharacters? <bing-du@tamu.edu>
Re: frames without files ? <No_4@dsl.pipex.com>
Re: how to check file size (very large! > 2GB) using Pe <nobody@dev.null>
Re: How to create a file in cgi/perl? <trond@bwsnett.no>
Re: new Perl feature request: call into shared libs <nick@nick8325.freeserve.co.uk>
Question about PERL modules EXPECT/Net::Telnet (Brian Snyder)
Re: regexp and grouping (Sara)
Re: regexp and grouping (Anno Siegel)
Re: regexp and grouping <abigail@abigail.nl>
Re: remote control with perl <REMOVEsdnCAPS@comcast.net>
TCP testing... <carriera@nortelnetworks.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Mar 2003 20:53:22 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Adding Perl library to default OS X Server install
Message-Id: <b58102$8uq$1@mamenchi.zrz.TU-Berlin.DE>
Stephan Bour <sbour@niaid.nih.gov> wrote in comp.lang.perl.misc:
> -=-=-=-=-=-
>
> Under Macintosh OS 10.2.4: I'm trying to install the perl MIME:64 module and
> the Makefile complains that it can't find the perl.h library to complete the
> install. Is there a reason why some perl modules are absent in the OS X
> Server version of Perl?
perl.h is part of a standard Perl installation. Under 10.1.5 it's under
/Library/Perl/darwin/CORE/perl.h, though that may have changed.
> Any reason why I couldn't reinstall Perl from the
> standard distribution?
I did that on my mac, it runs Perl 5.8.0 just fine. Or are you saying
you tried and failed? To be safe, you can always install a second Perl
(the standard locations are free on MacOS) and run that.
Anno
------------------------------
Date: 18 Mar 2003 21:48:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Anyone For Golf? (Resistor Colour Codes)
Message-Id: <b58489$b3h$1@mamenchi.zrz.TU-Berlin.DE>
Jasper <jasper@mccrea.demon.co.uk> wrote in comp.lang.perl.misc:
> #!perl -l
> print map{.5*index acowdzanlleeueoleyit,/..(..?)/&&$1}@ARGV
>
> think this is around 62
None of your solutions interprets the third ring as so many zeroes.
Under Perl 5.8.0, sprintf can do this at little letter cost:
printf "%d%d%0*d", @three_numbers, 0;
The third of @three_numbers gives the number of trailing zeroes. Except
when the third ring is black, when it prints a zero it shouldn't. I'm
not that familiar with color code, but by Murphy the third ring *can*
be black.
Anno
------------------------------
Date: 18 Mar 2003 14:39:46 -0700
From: jtc@flatland.dimensional.com (Jim Cochrane)
Subject: Array reference argument to subroutine problem
Message-Id: <slrnb7f4h1.pe7.jtc@flatland.dimensional.com>
The web page "Passing Parameters to Functions" (
http://www.cs.cf.ac.uk/Dave/PERL/node61.html#SECTION00920000000000000000
) describes how to use references to pass more than one array to a
subroutine and distinguish between the two arrays in the subroutine.
Unfortunately, on my system (perl -v5.6.1 on Redhat 7.3), this does not
work. When I run the script below (the 2nd example on the above page),
I get the following results:
$ /tmp/ref.pl
The first array is .
The second array is .
The web page says the output should be:
The first array is 1 2 3 4 5.
The second array is A B C D E.
What's up here? Is my version of Perl too old? (I doubt it - it's not
that old.) Is the page wrong? Something else - environment setting, ...?
Thanks!
#!/usr/bin/perl -w
firstSub( (1..5), ("A".."E"));
sub firstSub {
my($ref_firstArray, $ref_secondArray) = @_;
print("The first array is @{$ref_firstArray}.\n");
print("The second array is @{$ref_secondArray}.\n");
}
--
Jim Cochrane
jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
------------------------------
Date: Tue, 18 Mar 2003 21:47:18 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Array reference argument to subroutine problem
Message-Id: <x78yvcwdne.fsf@mail.sysarch.com>
>>>>> "JC" == Jim Cochrane <jtc@flatland.dimensional.com> writes:
JC> The web page "Passing Parameters to Functions" (
JC> http://www.cs.cf.ac.uk/Dave/PERL/node61.html#SECTION00920000000000000000
JC> ) describes how to use references to pass more than one array to a
JC> subroutine and distinguish between the two arrays in the subroutine.
JC> Unfortunately, on my system (perl -v5.6.1 on Redhat 7.3), this does not
JC> work. When I run the script below (the 2nd example on the above page),
JC> I get the following results:
junk that web site. it looks like a typical crappy free perl tutorial.
the second example has a bug in it as well as misleading documentation.
a (rare) very good perl tuturial is at:
http://www.ebb.org/PickingUpPerl/
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class
------------------------------
Date: Tue, 18 Mar 2003 21:51:49 GMT
From: "dw" <me@verizon.invalid>
Subject: Re: Array reference argument to subroutine problem
Message-Id: <VxMda.72791$gi1.4447@nwrdny02.gnilink.net>
"Jim Cochrane" <jtc@flatland.dimensional.com> wrote in message
news:slrnb7f4h1.pe7.jtc@flatland.dimensional.com...
> The web page "Passing Parameters to Functions" (
> http://www.cs.cf.ac.uk/Dave/PERL/node61.html#SECTION00920000000000000000
> ) describes how to use references to pass more than one array to a
> subroutine and distinguish between the two arrays in the subroutine.
> $ /tmp/ref.pl
> The first array is .
> The second array is .
>
> The web page says the output should be:
>
> The first array is 1 2 3 4 5.
> The second array is A B C D E.
>
> What's up here? Is my version of Perl too old? (I doubt it - it's not
> that old.) Is the page wrong? Something else - environment setting, ...?
It doesn't work on my system either because there is an error in the code.
If you read at the bottom of the page:
In the line marked "One," backslashes were added to indicate that a
reference to the array should be passed.
Well... somehow in the code, the backslashes didn't get added. The correct
line should be:
firstSub( \(1..5), \("A".."E"));
or using square brackets to create an array referece:
firstSub( [1..5], ["A".."E"] );
>
>
> #!/usr/bin/perl -w
>
> firstSub( (1..5), ("A".."E"));
>
> sub firstSub {
> my($ref_firstArray, $ref_secondArray) = @_;
>
> print("The first array is @{$ref_firstArray}.\n");
> print("The second array is @{$ref_secondArray}.\n");
> }
>
------------------------------
Date: Tue, 18 Mar 2003 22:02:52 GMT
From: "David" <perl-dvd@darklaser.com>
Subject: Re: Array reference argument to subroutine problem
Message-Id: <gIMda.17$Kz6.11395@news-west.eli.net>
"Jim Cochrane" <jtc@flatland.dimensional.com> wrote in message
news:slrnb7f4h1.pe7.jtc@flatland.dimensional.com...
> The web page "Passing Parameters to Functions" (
>
http://www.cs.cf.ac.uk/Dave/PERL/node61.html#SECTION00920000000000000000
> ) describes how to use references to pass more than one array to a
> subroutine and distinguish between the two arrays in the subroutine.
> Unfortunately, on my system (perl -v5.6.1 on Redhat 7.3), this does
not
> work. When I run the script below (the 2nd example on the above
page),
> I get the following results:
>
> $ /tmp/ref.pl
> The first array is .
> The second array is .
>
> The web page says the output should be:
>
> The first array is 1 2 3 4 5.
> The second array is A B C D E.
>
> What's up here? Is my version of Perl too old? (I doubt it - it's
not
> that old.) Is the page wrong? Something else - environment setting,
...?
Yes the example is flawed, see below for the correct syntax.
>
> #!/usr/bin/perl -w
>
> firstSub( (1..5), ("A".."E"));
>
> sub firstSub {
> my($ref_firstArray, $ref_secondArray) = @_;
>
> print("The first array is @{$ref_firstArray}.\n");
> print("The second array is @{$ref_secondArray}.\n");
> }
Try this:
firstSub([1..5], ["A".."E"]);
instead of what they provided.
Regards,
David
perl -e'print for map chr$_+1,"111100113107044099117099132"=~/(.{3})/g'
------------------------------
Date: 18 Mar 2003 15:35:15 -0700
From: jtc@flatland.dimensional.com (Jim Cochrane)
Subject: Re: Array reference argument to subroutine problem
Message-Id: <slrnb7f7p2.pe7.jtc@flatland.dimensional.com>
In article <VxMda.72791$gi1.4447@nwrdny02.gnilink.net>, dw wrote:
>
>"Jim Cochrane" <jtc@flatland.dimensional.com> wrote in message
>news:slrnb7f4h1.pe7.jtc@flatland.dimensional.com...
>> The web page "Passing Parameters to Functions" (
>> http://www.cs.cf.ac.uk/Dave/PERL/node61.html#SECTION00920000000000000000
>> ) describes how to use references to pass more than one array to a
>> subroutine and distinguish between the two arrays in the subroutine.
>> $ /tmp/ref.pl
>> The first array is .
>> The second array is .
>>
>> The web page says the output should be:
>>
>> The first array is 1 2 3 4 5.
>> The second array is A B C D E.
>>
>> What's up here? Is my version of Perl too old? (I doubt it - it's not
>> that old.) Is the page wrong? Something else - environment setting, ...?
>It doesn't work on my system either because there is an error in the code.
>If you read at the bottom of the page:
>In the line marked "One," backslashes were added to indicate that a
>reference to the array should be passed.
>
>Well... somehow in the code, the backslashes didn't get added. The correct
>line should be:
> firstSub( \(1..5), \("A".."E"));
>or using square brackets to create an array referece:
> firstSub( [1..5], ["A".."E"] );
I see - you have to explicitly pass the arguments as references.
Thanks much!
>>
>> #!/usr/bin/perl -w
>>
>> firstSub( (1..5), ("A".."E"));
>>
>> sub firstSub {
>> my($ref_firstArray, $ref_secondArray) = @_;
>>
>> print("The first array is @{$ref_firstArray}.\n");
>> print("The second array is @{$ref_secondArray}.\n");
>> }
>>
--
Jim Cochrane
jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
------------------------------
Date: 18 Mar 2003 15:40:22 -0700
From: jtc@flatland.dimensional.com (Jim Cochrane)
Subject: Re: Array reference argument to subroutine problem
Message-Id: <slrnb7f82m.pe7.jtc@flatland.dimensional.com>
In article <x78yvcwdne.fsf@mail.sysarch.com>, Uri Guttman wrote:
>>>>>> "JC" == Jim Cochrane <jtc@flatland.dimensional.com> writes:
>
> JC> The web page "Passing Parameters to Functions" (
> JC> http://www.cs.cf.ac.uk/Dave/PERL/node61.html#SECTION00920000000000000000
> JC> ) describes how to use references to pass more than one array to a
> JC> subroutine and distinguish between the two arrays in the subroutine.
> JC> Unfortunately, on my system (perl -v5.6.1 on Redhat 7.3), this does not
> JC> work. When I run the script below (the 2nd example on the above page),
> JC> I get the following results:
>
>junk that web site. it looks like a typical crappy free perl tutorial.
>
>the second example has a bug in it as well as misleading documentation.
>
>a (rare) very good perl tuturial is at:
>
> http://www.ebb.org/PickingUpPerl/
>
[I responded earlier, but either I send mail instead of posting, or the
post has not shown up yet. Apologies for any double posting.]
Thanks for the URL. However, I'm getting an alert:
"The connection was refused when attempting to contact www.ebb.org"
Perhaps their server is temporarily down.
--
Jim Cochrane
jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
------------------------------
Date: Tue, 18 Mar 2003 20:50:03 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Can I use session Variables in Perl
Message-Id: <pkent77tea-76AD6C.20455918032003@[10.1.1.10]>
In article <3E76DC88.4090605@lvivmedia.lviv.net>,
Yurij Nykon <ynykon@lvivmedia.lviv.net> wrote:
> How can I install module CGI:Session on Windows OS?
Either using the PPM or CPAN shells.
> Is this modul intended only for Apache Servers?
I doubt it, but read the docs. Apache does run on windows machines too.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: 18 Mar 2003 19:55:28 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Determining String Membership
Message-Id: <b57tjg$9ra$1@canopus.cc.umanitoba.ca>
In article <b576ei$6uk$1@newssrv.hl.siemens.de>,
Carsten Rau <does.not@exist.de> wrote:
:Now I would like to know if a loop or a '|' regexp is more efficient to
:match multiple expressions?
If you are using the standard perl regexp engine, then
*generally speaking*, testing each alternative individually
is faster than testing a single pattern created by join '|'
[I don't know if this changed in 5.8.]
The reasoning here is that perl does not use a state machine
for its regex matching [at least up to 5.6]. If it used a
state machine then it would examine the characters one at a time
always going forward, keeping enough internal information to
know where it was in all the alternatives simultaneously.
But it doesn't [didn't?] use a state engine, so each time it
finds a match failure, it goes back to the last logical boundary
and reprocesses the string from there. If you have a long
stream of |-joined patterns that could mean a lot of
reversions, whereas when you do one pattern at a time, the
engine can be smarter about when to give up on each pattern.
If you are not using some of the more complex regex
extensions, then you may wish to use one of the CPAN modules
that can only handle a subset of perl match operators but
can build finite state machines to do the match processing
for what it can handle, much the same way that 'egrep' works
internally.
5.8 Does Things Differently, and I am not qualified to make any
comments about regex matching in it.
--
Everyone has a "Good Cause" for which they are prepared to Spam.
-- Roberson's Law of the Internet
------------------------------
Date: Tue, 18 Mar 2003 21:38:25 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Determining String Membership
Message-Id: <b580ij$24mcr2$1@ID-184292.news.dfncis.de>
rymoore wrote:
> @SERVERS = ("fred","barney","wilma");
>
> I then need to search through a file and keep any lines that have these
> server names in them.
>
> while(<FILE>) {
> if (current line contains one of the server names) {
> print the line;
> }
I followed Anno's advise and compared a few solutions with help of the
Benchmark module. Each solution was run five times, and the interval of
CPUs is noted below.
1. foreach loop with simple regex pattern
while (<FILE>) {
for my $pattern (@SERVERS) {
if ($_ =~ /$pattern/) {
print;
last;
}
}
}
Took 8.3 - 8.7 CPU
2. foreach loop with index() function
while (<FILE>) {
for my $server (@SERVERS) {
if ((index $_, $server) >= 0) {
print;
last;
}
}
}
Took 3.1 - 3.5 CPU
3. foreach loop with qr// operator
@compiled = map { qr/$_/ } @SERVERS;
while (<FILE>) {
for my $patobj (@compiled) {
print if /$patobj/;
}
}
Took 3.8 - 3.9 CPU
4. join '|' solution
$pattern = join '|', map quotemeta, @SERVERS;
/$pattern/o and print while <FILE>;
Took 4.2 - 4.6 CPU
To make the alternatives comparable, I didn't include word boundaries.
Conclusions:
1) As long as you don't need to include word boundaries (or other
regexp stuff), the index() function in a foreach loop seems to
be most efficient.
2) If word boundaries are needed, a foreach loop in combination with
the qr// operator seems to be best.
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 18 Mar 2003 14:16:20 -0600
From: Bing Du Test <bing-du@tamu.edu>
Subject: Re: disable pattern metacharacters?
Message-Id: <3E777E94.9B7050EB@tamu.edu>
No it's not. Also from perlop, it says:
"You cannot include a literal $ or @ within a \Q sequence. An
unescaped $ or @ interpolates the corresponding variable,
while escaping will cause the literal string \$ to be
inserted. You'll need to write something like
m/\Quser\E\@\Qhost/."
Bing
ebchang wrote:
> Bing Du Test <bing-du@tamu.edu> wrote in news:3E77425E.A70C4933@tamu.edu:
>
> > By the way, I want an exact match. That is if @bar is changed to "@bar =
> > ('a+b+e','c+d')", $foo should not be in @bar.
> >
> > From my testing, seems grep(/\Q$foo/i,@bar) says 'foo is in bar' for both
> > @bar cases. But grep(/^\Q$foo$/i,@bar) which is really what I want does
> > not.
> >
> > So help is still needed.
>
> your \Q is also escaping the $.
>
> From perlop:
>
> \Q quote non-word characters till \E
>
> --
> EBC
------------------------------
Date: Tue, 18 Mar 2003 19:22:22 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: frames without files ?
Message-Id: <3e7771ee$0$21990$cc9e4d1f@news.dial.pipex.com>
> YES, I know how to generate javascript from perl to fill in some
> of the blanks on the (existing) TOC (table of contents) page.
>
> But my main thing I don't see clearly yet is how to make my perl
> output THREE html pages (the frame set, the TOC, and the body text).
Something like this (please adjust for incorrect HTML):
<SCRIPT>
function frame1() {
return "<HTML><BODY>Text for Frame1</BODY></HTML";
}
function frame2() {
return "<HTML><BODY>Text for Frame2</BODY></HTML";
}
<FRAMESET>
<FRAME SRC="javascript:frame1()">
<FRAME SRC="javascript:frame2()">
</FRAMESET>
--
-*- Just because I've written it here doesn't -*-
-*- mean that you should, or I do, believe it. -*-
------------------------------
Date: Tue, 18 Mar 2003 20:23:47 GMT
From: Andras Malatinszky <nobody@dev.null>
Subject: Re: how to check file size (very large! > 2GB) using Perl
Message-Id: <3E777FE4.3070703@dev.null>
Yong Liu wrote:
> Hi,
>
> I have got a problem using either -s $filename or stat $filename to get
> the correct information about the file size. Here is what I got:
>
> output of -s $filename
> File Size: -1522664308 bytes
>
> output of stat $filename:
> 50331653 629146686 33184 1 22909 10245 0 -1522664308 1048004742 1047655840
> 1047655840 131072 5414720
>
> The actual file size should be:2772302988 bytes (using ls -al)
>
> So how should I check the file size for this kind of large file using
> Perl?
>
Looks like an overflow error. Since your OS displays the right file
size, you could cheat a little and do something like
$ls_says=`ls -l $filename`;
$filesize=(split/\s+/,$ls_says)[4];
This is untested and clearly OS-dependent.
------------------------------
Date: Tue, 18 Mar 2003 21:38:50 +0100
From: "Trond Johansen" <trond@bwsnett.no>
Subject: Re: How to create a file in cgi/perl?
Message-Id: <b58054$1regg5$1@ID-175630.news.dfncis.de>
Thank-You!
It worked for me!
-Trond Johansen
"Trond Johansen" <trond@bwsnett.no> skrev i melding
news:b57kij$25sts3$1@ID-175630.news.dfncis.de...
> Hi.
>
> I'm a beginner in perl
> I know how to write into a file that allready exist on my server,
> but I don't know the script to write a new file.
>
> I wan't to write a file with variables from a form as ex:
> $date$year.html
> The file should be readable for everyone.
> Anyone who can help me with that little script?
>
> Trond Johansen
>
>
------------------------------
Date: Tue, 18 Mar 2003 21:42:51 -0000
From: "Nick" <nick@nick8325.freeserve.co.uk>
Subject: Re: new Perl feature request: call into shared libs
Message-Id: <b583qi$26r9ot$1@ID-163406.news.dfncis.de>
"Matt Taylor" <para@tampabay.rr.com> wrote in message
news:Egyda.84612$lW3.3144455@twister.tampabay.rr.com...
> "Ilya Zakharevich" <nospam-abuse@ilyaz.org> wrote in message
> news:b55jlj$30cn$1@agate.berkeley.edu...
> > [A complimentary Cc of this posting was sent to
> > Matt Taylor
> > <para@tampabay.rr.com>], who wrote in article
> <v9gca.58137$lW3.2011891@twister.tampabay.rr.com>:
> > > > > > Actually, one could also duplicate the last min(3, num_params)
> > > > > > arguments in EAX, EDX, ECX. This way the same code could call
> > > > > > __regparam__(3) functions too.
> > > >
> > > > > Why not have the calling convention used as a parameter?
> > > >
> > > > What for - if one can avoid it?
> > >
> > > The premise is not valid. That is, you can't avoid it.
> >
> > See above recipe; which translates the calling convention into
> > reordering of arguments.
>
> Convention is more than reordering of arguments.
>
> > > > > I don't see why you would try to satisfy all schemes with one
> > > > > function.
> > > >
> > > > Why not - if this is easy to do? Change 3 to 6 above, and duplicate
> > > > the last 6 arguments in 6 standard registers; then providing
arguments
> > > > to the wrapper function in a "correct" order will satisfy any
"input"
> > > > calling convention.
> > >
> > > Last I checked GCC did not support __regparm__(6) on x86. That was GCC
> 2.x.
> > > It may be supported in GCC 3.x, but I doubt it. Most
industrial-strength
> > > compilers do not support more than 3 registers for a register call
> scheme
> > > for 2 reasons:
> >
> > When I checked it circa 10 years ago, Watcom allowed (more or less?)
> > arbitrary calling conventions (by #pragmas).
>
> And still does. It's not heavily used anymore, though.
>
Although it might well gain some popularity now, with the release of
OpenWatcom (www.openwatcom.org).
------------------------------
Date: 18 Mar 2003 11:43:33 -0800
From: bsnyder030174@yahoo.com (Brian Snyder)
Subject: Question about PERL modules EXPECT/Net::Telnet
Message-Id: <668c9529.0303181143.b281c90@posting.google.com>
Hi all,
I am coding a perl script that will be responsible for kicking off a
couple different telnet sessions and capturing their output. I
believe I will get teh script to kick off multiple sessions
simultaneously by making use of the fork() command.
My question is that I've been doing some research on the newsgroups
and searching on cpan and I found multiple recommendations from
people. Some saying to use Expect and some saying to use Net::Telnet
in order to drive my telnet sessions. Many of these
posts/recommendations were very old, and I'm just curious what the
current state of these projects are? Is one much easier to use then
the other... anybody have experience with both packages and could
recommend one over the other?
Thanx,
---brian
------------------------------
Date: 18 Mar 2003 13:23:44 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: regexp and grouping
Message-Id: <776e0325.0303181323.5944eb8d@posting.google.com>
Abigail <abigail@abigail.nl> wrote in message news:<slrnb7cnf2.ug8.abigail@alexandra.abigail.nl>...
> Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMCDLXXXV
> September MCMXCIII in <URL:news:b55csg$2ar$1@mamenchi.zrz.TU-Berlin.DE>:
> :: > [] my @hits = 'what is wrong with my brain' =~ /(r.)/g;
> :: >
>
> You want to use something like:
>
> /@{[ do { local $_ = "\Q$_"; s!r.!(r.)!g; $_}]}/;
>
> instead.
>
>
> Abigail
The expressions you all are coming up with are "what's wrong with my
brain"- your hurting it!
------------------------------
Date: 18 Mar 2003 22:14:12 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: regexp and grouping
Message-Id: <b585nk$btk$1@mamenchi.zrz.TU-Berlin.DE>
Sara <genericax@hotmail.com> wrote in comp.lang.perl.misc:
> Abigail <abigail@abigail.nl> wrote in message
> news:<slrnb7cnf2.ug8.abigail@alexandra.abigail.nl>...
> > Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMCDLXXXV
> > September MCMXCIII in <URL:news:b55csg$2ar$1@mamenchi.zrz.TU-Berlin.DE>:
>
> > :: > [] my @hits = 'what is wrong with my brain' =~ /(r.)/g;
> > :: >
>
> >
> > You want to use something like:
> >
> > /@{[ do { local $_ = "\Q$_"; s!r.!(r.)!g; $_}]}/;
> >
> > instead.
> >
> >
> > Abigail
>
> The expressions you all are coming up with are "what's wrong with my
> brain"- your hurting it!
Oh, then just to add to the fun...
/@{[ map ".*(r.)", m!r.!g ]}/x;
This is a variation on Abigail's theme.
Anno
------------------------------
Date: 18 Mar 2003 22:41:05 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: regexp and grouping
Message-Id: <slrnb7f841.u4a.abigail@alexandra.abigail.nl>
Abigail (abigail@abigail.nl) wrote on MMMCDLXXXV September MCMXCIII in
<URL:news:slrnb7cnf2.ug8.abigail@alexandra.abigail.nl>:
^^ Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMCDLXXXV
^^ September MCMXCIII in <URL:news:b55csg$2ar$1@mamenchi.zrz.TU-Berlin.DE>:
^^ :: Abigail <abigail@abigail.nl> wrote in comp.lang.perl.misc:
^^ :: > Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMCDLXXXV
^^ :: > September MCMXCIII in <URL:news:b547i5$1hs$2@mamenchi.zrz.TU-Berlin.DE>:
^^ :: > [] Bjørnar Libæk <bjoernal@ifi.uio.no> wrote in comp.lang.perl.misc:
^^ :: > [] > Given the string "what is wrong with my brain", I want to get ever
^^ :: > [] > two-letter composition that starts with an 'r' into the grouping-va
^^ :: > [] > that is, $1='ro' and $2='ra' in this example. How do I do this?
^^ :: > []
^^ :: > [] my @hits = 'what is wrong with my brain' =~ /(r.)/g;
^^ :: >
^^ :: >
^^ :: > That doesn't set $2, and doesn't set $1 to 'ro'. It only sets $1,
^^ :: > and sets it to 'ra'.
^^ ::
^^ :: Right.
^^ ::
^^ :: > The following will set $1 to 'ro', and $2 = 'ra':
^^ :: >
^^ :: >
^^ :: > $_ = 'what is wrong with my brain';
^^ :: > /@{[".*(r.)" x (() = m(r.)g)]}/;
^^ :: > print "<$1> <$2>\n";
^^ :: > __END__
^^ :: > <ro> <ra>
^^ ::
^^ :: ... or
^^ ::
^^ :: /@{[ do { local $_ = $_; s!r.!(r.)!g; $_}]}/;
^^
^^
^^ That would fail on:
^^
^^ $_ = "what is (wrong) with my brain";
^^
^^
^^ You want to use something like:
^^
^^ /@{[ do { local $_ = "\Q$_"; s!r.!(r.)!g; $_}]}/;
^^
^^ instead.
And that's going to fail on
$_ = 'what is wr ong with my brain";
Abigail
--
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";
------------------------------
Date: Tue, 18 Mar 2003 13:06:37 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: remote control with perl
Message-Id: <Xns93428F871B581sdn.comcast@216.166.71.239>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
stinkbomb <user@someserver123abc.com> wrote in
news:3E773B18.C9D5959@someserver123abc.com:
> anyone tried remote control with perl?
>
> I guess someway to make a perl script daemon on a server.
> and maybe access it with a web browser?
You keep on asking vague questions with no context, and only provide
details when asked. Stop doing that. Please read the posting guidelines
for comp.lang.perl.misc. You can google for it.
- --
Eric
print scalar reverse sort qw p ekca lre reh
ts uJ p, $/.r, map $_.$", qw e p h tona e;
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPnduMGPeouIeTNHoEQK7RQCg6R60RkNS0ZzuLGCZ8GynTsWVxV8AnRbZ
tf4eLJsmXQmqVrxnWTjUDMOy
=SUJ/
-----END PGP SIGNATURE-----
------------------------------
Date: Fri, 14 Mar 2003 22:20:13 -0600
From: "Al" <carriera@nortelnetworks.com>
Subject: TCP testing...
Message-Id: <b4u9pr$11q$1@zcars0v6.ca.nortel.com>
Newby alert! I'm not going to say this is probably a stupid question (but
it probably is).
I just want a simple script that I can call and specify an IP address, a
port and a packet size.
The script would then send a TCP packet to that destination. I was able to
do it for UDP...
thanks,
Al
------------------------------
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 4726
***************************************