[23507] in Perl-Users-Digest
Perl-Users Digest, Issue: 5717 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 27 21:06:00 2003
Date: Mon, 27 Oct 2003 18:05:09 -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 Mon, 27 Oct 2003 Volume: 10 Number: 5717
Today's topics:
Re: array of hashrefs (nested) (James E Keenan)
Re: array of hashrefs (nested) (Tad McClellan)
Re: array of hashrefs (nested) <fm_duendeBASURA@yahoo.com>
Re: array of hashrefs (nested) <usenet@morrow.me.uk>
Re: array of hashrefs (nested) <syscjm@gwu.edu>
Re: array of hashrefs (nested) <invalid-email@rochester.rr.com>
Re: Balanced Text?? <michael.p.broida@boeing_oops.com>
Re: Balanced Text?? <usenet@dwall.fastmail.fm>
debugging multi-file scripts using perldb (Gaurav Shah)
Guide for dealing with alternate character sets? (Bernie Cosell)
Re: Guide for dealing with alternate character sets? <flavell@ph.gla.ac.uk>
Re: How to generate this list? <nospam_for_jkeen@concentric.net>
Re: Installing Module on Remote Host <mb@uq.net.au>
Re: Is there a VAR to count the number of occurences of <emschwar@pobox.com>
Re: Is there a VAR to count the number of occurences of (Malcolm Dew-Jones)
Re: Is there a VAR to count the number of occurences of <noreply@gunnar.cc>
Re: Is there a VAR to count the number of occurences of <emschwar@pobox.com>
Re: Kill forked process on Windows 2000 <slaven@rezic.de>
Re: Perl and IIS - script runs but 'The page cannot be (stew dean)
Re: Perl and IIS - script runs but 'The page cannot be (stew dean)
Re: Perl and IIS - script runs but 'The page cannot be (stew dean)
Re: Printing folder contents (Tad McClellan)
Re: Question <usenet@morrow.me.uk>
Re: strange effect with [:lower:] in perl <abigail@abigail.nl>
Re: strange effect with [:lower:] in perl <usenet@morrow.me.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 27 Oct 2003 13:26:49 -0800
From: jkeen@concentric.net (James E Keenan)
Subject: Re: array of hashrefs (nested)
Message-Id: <b955da04.0310271326.5ea934cf@posting.google.com>
monkeys paw <fm_duendeBASURA@yahoo.com> wrote in message news:<xbbnb.40819$Fm2.16610@attbi_s04>...
> I have the following code that is behaving stragely:
>
> use Data::Dumper;
>
> %pair = (
> 'Subject' => 'Vapor,Bob-war,new-tag',
> 'Analyst' => 'simi'
> );
>
> for my $heading (sort keys %pair) {
> @tags = ();
> for my $tag (split /,/, $pair{$heading}) {
> push @tags, {tag_key => $tag, tag_name => $tag};
> }
> push @headings, {
You obviously were not running with 'use strict;' called. Otherwise
you would have gotten a compilation error right here.
> heading_name => $heading,
> tags => \@tags,
> };
> }
> print Dumper(\@headings) ;
>
> The output is:
>
> HAT2: $VAR1 = [
> {
> 'tags' => [
> {
> 'tag_key' => 'Vapor',
> 'tag_name' => 'Vapor'
> },
> {
> 'tag_key' => 'Bob-war',
> 'tag_name' => 'Bob-war'
> },
> {
> 'tag_key' => 'new-tag',
> 'tag_name' => 'new-tag'
> }
> ],
> 'heading_name' => 'Analyst'
> },
> {
> 'tags' => $VAR1->[0]{'tags'},
> 'heading_name' => 'Subject'
> }
> ];
>
> What is causing the 'tags' => $VAR1->[0]{'tags'}, line to
> show up?? I would expect it to be
>
> 'tags' => {
> 'tag_key' => 'new-tag',
> 'tag_name' => 'new-tag'
> }
Once I properly scoped all variables with 'my' and used strict, I got
these results:
$VAR1 = [
{
'heading_name' => 'Analyst',
'tags' => [
{
'tag_name' => 'simi',
'tag_key' => 'simi'
}
]
},
{
'heading_name' => 'Subject',
'tags' => [
{
'tag_name' => 'Vapor',
'tag_key' => 'Vapor'
},
{
'tag_name' => 'Bob-war',
'tag_key' => 'Bob-war'
},
{
'tag_name' => 'new-tag',
'tag_key' => 'new-tag'
}
]
}
];
jimk
------------------------------
Date: Mon, 27 Oct 2003 16:05:27 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: array of hashrefs (nested)
Message-Id: <slrnbpr5l7.bum.tadmc@magna.augustmail.com>
monkeys paw <fm_duendeBASURA@yahoo.com> wrote:
> I have the following code that is behaving stragely:
If you drive without your seatbelt fastened, then you should
be prepared for a trip through the windshield. :-)
use strict;
would have saved you from this problem...
> for my $heading (sort keys %pair) {
> @tags = ();
> for my $tag (split /,/, $pair{$heading}) {
> push @tags, {tag_key => $tag, tag_name => $tag};
> }
> push @headings, {
> heading_name => $heading,
> tags => \@tags,
> };
> }
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 27 Oct 2003 23:13:12 GMT
From: monkeys paw <fm_duendeBASURA@yahoo.com>
Subject: Re: array of hashrefs (nested)
Message-Id: <cEhnb.42923$Fm2.18440@attbi_s04>
> monkeys paw <fm_duendeBASURA@yahoo.com> wrote:
>
>> I have the following code that is behaving stragely:
>
>
> If you drive without your seatbelt fastened, then you should
> be prepared for a trip through the windshield. :-)
>
> use strict;
>
> would have saved you from this problem...
>
Thanks all for the advice. Upon closer inspection i understand
how localizing the @tags array would save me this problem. However,
just as a side note, "use strict" would not detect this error that
i see. I was overwriting a global, which is perfectly legal.
Anyway, just wanted to make sure i wasn't missing something on
this corrolary...thanks again for the help.
>
>> for my $heading (sort keys %pair) {
>> @tags = ();
>> for my $tag (split /,/, $pair{$heading}) {
>> push @tags, {tag_key => $tag, tag_name => $tag};
>> }
>> push @headings, {
>> heading_name => $heading,
>> tags => \@tags,
>> };
>> }
>
>
------------------------------
Date: Tue, 28 Oct 2003 00:49:35 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: array of hashrefs (nested)
Message-Id: <bnkeev$n61$1@wisteria.csv.warwick.ac.uk>
fm_duendeBASURA@yahoo.com wrote:
> Thanks all for the advice. Upon closer inspection i understand
> how localizing the @tags array would save me this problem. However,
> just as a side note, "use strict" would not detect this error that
> i see. I was overwriting a global, which is perfectly legal.
...except under strictures :). That is of course not strictly (sic)
true: it is perfectly possible to use package globals under 'strict',
bit you must make it clear that you meant to and haven't simply made a
mistake by either declaring them with 'our' or fully qualifying the
name.
Ben
--
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk
------------------------------
Date: Mon, 27 Oct 2003 20:32:42 -0500
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: array of hashrefs (nested)
Message-Id: <3F9DC73A.7030305@gwu.edu>
monkeys paw wrote:
>>monkeys paw <fm_duendeBASURA@yahoo.com> wrote:
>>
>>
>>>I have the following code that is behaving stragely:
>>
>>
>>If you drive without your seatbelt fastened, then you should
>>be prepared for a trip through the windshield. :-)
>>
>> use strict;
>>
>>would have saved you from this problem...
>>
>
>
> Thanks all for the advice. Upon closer inspection i understand
> how localizing the @tags array would save me this problem. However,
> just as a side note, "use strict" would not detect this error that
> i see. I was overwriting a global, which is perfectly legal.
Except that when you do "use strict;", Perl doesn't merrily assume
that all your undeclared variables are globals. You have to declare
them as either local (my) or global (global) or whatever. Strict
will kill the compilation if you attempt to use a variable you haven't
declared. "use strict" doesn't stop you from hanging yourself, but it
does at least make you write a requisition order for the rope.
Chris Mattern
>
> Anyway, just wanted to make sure i wasn't missing something on
> this corrolary...thanks again for the help.
>
>
>>> for my $heading (sort keys %pair) {
>>> @tags = ();
>>> for my $tag (split /,/, $pair{$heading}) {
>>> push @tags, {tag_key => $tag, tag_name => $tag};
>>> }
>>> push @headings, {
>>> heading_name => $heading,
>>> tags => \@tags,
>>> };
>>> }
>>
>>
>
------------------------------
Date: Tue, 28 Oct 2003 01:55:48 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: array of hashrefs (nested)
Message-Id: <3F9DCC8C.5050100@rochester.rr.com>
monkeys paw wrote:
>>monkeys paw <fm_duendeBASURA@yahoo.com> wrote:
...
>> use strict;
>>
>>would have saved you from this problem...
>>
>>
>
> Thanks all for the advice. Upon closer inspection i understand
> how localizing the @tags array would save me this problem. However,
> just as a side note, "use strict" would not detect this error that
> i see. I was overwriting a global, which is perfectly legal.
>
> Anyway, just wanted to make sure i wasn't missing something on
> this corrolary...thanks again for the help.
>
>
>>> for my $heading (sort keys %pair) {
>>> @tags = ();
>>> for my $tag (split /,/, $pair{$heading}) {
>>> push @tags, {tag_key => $tag, tag_name => $tag};
>>> }
>>> push @headings, {
>>> heading_name => $heading,
>>> tags => \@tags,
>>> };
>>> }
...
I think perhaps you still don't understand. Here is a short program and
its output that illustrates the essence of the problem:
@array=(1,2,3);
$array_ref1=\@array;
@array=(4,5,6);
$array_ref2=\@array;
print @$array_ref1,"\n";
print @$array_ref2,"\n";
D:\junk>perl junk401.pl
456
456
D:\junk>
The problem (if you wish to call it a problem -- it is expected and
documented behavior) is that $array_ref1 and $array_ref2 are references
to the *exact same array*, the one called @array. The fact that the
*contents* of this array changed do not make the references change what
array they are pointing to. There *is only one* array, with two
references pointing to it. Hence when you're all done, both references
point to the same set of values. If you had 100 references, they would
all point to the same array.
Now, use strict; will in and of itself not fix this:
use warnings;
use strict;
my @array;
@array=(1,2,3);
my $array_ref1=\@array;
@array=(4,5,6);
my $array_ref2=\@array;
print @$array_ref1,"\n";
print @$array_ref2,"\n";
gives:
D:\junk>perl junk401a.pl
456
456
D:\junk>
And for the very same reasons. One can add a "my" to each array
definition and solve the problem:
use warnings;
use strict;
my @array=(1,2,3);
my $array_ref1=\@array;
my @array=(4,5,6);
my $array_ref2=\@array;
print @$array_ref1,"\n";
print @$array_ref2,"\n";
which gives:
D:\junk>perl junk401b.pl
"my" variable @array masks earlier declaration in same scope at
junk401.pl line 5.
123
456
D:\junk>
but at the expense of a warning. So how should this be handled? One
good approach is to do what you meant to do: make a reference to an
anonymous copy of the array each time, like:
use warnings;
use strict;
my @array;
@array=(1,2,3);
my $array_ref1=[@array];
@array=(4,5,6);
my $array_ref2=[@array];
print @$array_ref1,"\n";
print @$array_ref2,"\n";
which gives the desired:
D:\junk>perl junk401c.pl
123
456
D:\junk>
Previous posters have mentioned that use strict; would point out the
problem. Not really, in this case, although, since @tags was defined in
a loop, saying my @tags; would have solved the immediate problem -- but
not if there had been a reference taken to the array, a modification to
the array, and then another reference during the execution of the loop.
But use strict; is hugely beneficial for many many problems, and
should *always* be used, along with use warnings; , in all development code.
HTH.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Mon, 27 Oct 2003 20:06:13 GMT
From: MPBroida <michael.p.broida@boeing_oops.com>
Subject: Re: Balanced Text??
Message-Id: <3F9D7AB5.F2BC77E1@boeing_oops.com>
Malcolm Dew-Jones wrote:
>
> MPBroida (michael.p.broida@boeing_oops.com) wrote:
>
> : > exp::Common. The module Text::Balanced provides a
> : > ^^^^^^^^^^^^^^
> : > general solution to this problem.
>
> : Unfortunately,
> : there's little chance of updating the version here: too many
> : tools depend on it working EXACTLY as it does now. "Someday"
> : we'll update.
>
> : Thanks for the updated info. :)
>
> Text::Balanced says it requires perl 5.005
>
> (Which is much less than 5.6.anything)
>
> so I don't understand why you don't just install the module and use it.
I will do that, now that I have been informed of the ACTUAL name
of the module. This whole thread started with my question:
Is it named "Text::Balanced" or "Balanced::Text"?
Rather hard to FIND, much less install, a module you don't
know the name of. :/
The perldoc for our version of Perl does NOT contain the same
text that Mr. McClellan quoted from, so his latest response was
the first one to give me the info I requested.
I wasn't bemoaning not being able to install that module; as you
pointed out, it's quite possible to do. I was just pointing out
that our installation, being older, doesn't have the latest docs
with it, so I didn't have the info Mr. McClellan quoted, and there
are certainly other bits of info not on this installation as well.
Mike
------------------------------
Date: Mon, 27 Oct 2003 22:47:18 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Balanced Text??
Message-Id: <Xns9421B4F42AE9dkwwashere@216.168.3.30>
MPBroida <michael.p.broida@boeing_oops.com> wrote:
> Malcolm Dew-Jones wrote:
...
>> so I don't understand why you don't just install the module and
>> use it.
>
> I will do that, now that I have been informed of the ACTUAL
> name of the module. This whole thread started with my
> question:
> Is it named "Text::Balanced" or "Balanced::Text"?
> Rather hard to FIND, much less install, a module you don't
> know the name of. :/
http://search.cpan.org/ is a useful tool....
------------------------------
Date: 27 Oct 2003 12:39:56 -0800
From: g_s_shah@hotmail.com (Gaurav Shah)
Subject: debugging multi-file scripts using perldb
Message-Id: <94556837.0310271239.e2e82b2@posting.google.com>
I'm using perldb to debug scripts that call functions from many
different files, which are included with the "require" command.
How do I set a breakpoint in a function, or at a line, that is found
in a file other than the main one?
Thanks in advance,
-Gaurav Shah.
------------------------------
Date: 27 Oct 2003 14:51:25 -0800
From: bernie@fantasyfarm.com (Bernie Cosell)
Subject: Guide for dealing with alternate character sets?
Message-Id: <a2f641ca.0310271451.40e49b4f@posting.google.com>
I'm pretty buffaloed about the prospect of moving some of my programs
to the new version of RedHat that is native UTF-8. I don't understand
all the implications of it, and I wonder if there's some kind of
tutorial or programming or practices guide to deal with it besides
perlunicode(1)?
I note that much of my Perl code is already ugly because of a
character convention mismatch: on our system, the line terminator is
just \012, but on stuff coming in over a socket, the line terminator
is \015\012 and so I have some really sloppy code for inserting and
removing the "\r" in [most of? :o)] the right places in the code, but
it has always felt a bit awkward.
Once we move to the new system, it'll get worse: *most* of the stuff
coming in over TCP connections will still be just ISO-Latin [with
\r\n] and my "local files" will be UTF-8 [with just \n], and I don't
know *what* I'm going to do.
I've read the "perlunicode" man page and it is more or less clear, but
I'm not sure how to structure my program in an environment that
necessarily has to handle data streams that could be *either* UTF-8 or
ISO-Latin [it is at least fathomable, if a bit tricky, to do one or
the other]. And in the process, any tricks for cleaning up the
programming to handle \r\n vs \n on a per-stream basis would be
nice..:o)
Thanks!
/Bernie\
------------------------------
Date: Mon, 27 Oct 2003 23:39:56 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Guide for dealing with alternate character sets?
Message-Id: <Pine.LNX.4.53.0310272324290.27910@ppepc56.ph.gla.ac.uk>
On Mon, 27 Oct 2003, Bernie Cosell wrote:
> I'm pretty buffaloed about the prospect of moving some of my programs
> to the new version of RedHat that is native UTF-8. I don't understand
> all the implications of it, and I wonder if there's some kind of
> tutorial or programming or practices guide to deal with it besides
> perlunicode(1)?
That's a hard one at the moment. AFAICS the doc still has massively
raw edges, looking in places more like implementers' jottings than
finished user documentation. But it's getting there.
> I note that much of my Perl code is already ugly because of a
> character convention mismatch: on our system, the line terminator is
> just \012, but on stuff coming in over a socket, the line terminator
> is \015\012 and so I have some really sloppy code for inserting and
> removing the "\r"
<pounce>
What you're removing is \015. It might happen to be the same as \r
on your platform, but you should take heed of what perlport says.
> in [most of? :o)] the right places in the code, but
> it has always felt a bit awkward.
Seems to me that you need to get a grip on that *before* you tackle
unicode. Unicode sure doesn't help you with that detail (and if you
check the past discussions relating to utf-16, you'll see that we
seemed to have found a bug in newline handling here, which I'm afraid
I lost sight of, so I'm not sure if anyone took it to the developers
and/or found a resolution for).
> Once we move to the new system, it'll get worse: *most* of the stuff
> coming in over TCP connections will still be just ISO-Latin [with
> \r\n] and my "local files" will be UTF-8 [with just \n], and I don't
> know *what* I'm going to do.
Basically you need to either keep them apart, or settle on a canonical
internal representation and convert the other.
Try to keep internal and external representations apart, as if they
were measured in different currencies and had to be converted each
time they cross the border. The similarity is misleading - you'd
stand a better chance of getting this right if your internal coding
was totally different from the external one (as e.g IBM mainframes)
where such discipline is unavoidable.
> I've read the "perlunicode" man page and it is more or less clear, but
> I'm not sure how to structure my program in an environment that
> necessarily has to handle data streams that could be *either* UTF-8 or
> ISO-Latin
Will you be told, or do you have to guess?
And if you get anywhere near some recent Windows apps, you're likely
to get utf-16 to deal with also.
> [it is at least fathomable, if a bit tricky, to do one or
> the other]. And in the process, any tricks for cleaning up the
> programming to handle \r\n vs \n on a per-stream basis would be
> nice..:o)
If you want to work portably, please stop referring to \r\n when
dealing with sockets data: perlport's advice is better.
About the only positive thing I can say at this point is that CR and
LF are exactly the same in utf-8 as they are in iso-8859-1 as they are
in us-ascii.
------------------------------
Date: 27 Oct 2003 22:43:44 GMT
From: "James E Keenan" <nospam_for_jkeen@concentric.net>
Subject: Re: How to generate this list?
Message-Id: <bnk730$etn@dispatch.concentric.net>
"David Combs" <dkcombs@panix.com> wrote in message
news:bnjig5$4lj$1@reader1.panix.com...
> [snip]
> Now this, for John, Abigail, MJD, etc:
>
> "YOUR TASK, MR. PHELPS, IS TO PROGRAM THAT CSH ALGORITHM"
>
> How about an efficient algorithm on doing that?
>
Hey, David, instead of always asking these guys to write some Perl, why
don't *you* do that?
------------------------------
Date: Tue, 28 Oct 2003 09:26:29 +1000
From: Matthew Braid <mb@uq.net.au>
Subject: Re: Installing Module on Remote Host
Message-Id: <bnk9j5$oq1$1@bunyip.cc.uq.edu.au>
Mike wrote:
>>>use lib "/home3/mysite/modules";
>>
>>If that '3' is in your real code things won't work.
>
>
>
> My apologies for the confusion. In the original post, I was trying to
> take out as much unnecessary code as possible, and while the 3 is
> indeed there for my host, I had taken it out to simplify things in the
> beginning (or so I thought)...
>
> Sorry about that,
>
> Mike
As I said, I thought it was probably a typo, but it would have been a
nice quick fix if it hadn't :)
MB
------------------------------
Date: Mon, 27 Oct 2003 15:25:56 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Is there a VAR to count the number of occurences of matching
Message-Id: <etosmlejp1n.fsf@wormtongue.fc.hp.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
> shrek11001 wrote:
>> e.g.
>> $x =~ /A/g;
>> This var would provide the number of occurences of A in $x ...
>> Does it exist ? (according to perlvar, no, but ...)
>
> You are asking a FAQ
>
> perldoc -q count
Not *quite*. His example is a FAQ, but the general problem of, "how
many times did this regex match?" is not one-- the FAQ only talks of
substrings.
my $regex = qr/(\.)\1/;
while($string =~ $regex)
$count++;
}
print "matched $count times\n";
is one approach.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: 27 Oct 2003 14:55:17 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Is there a VAR to count the number of occurences of matching
Message-Id: <3f9da255@news.victoria.tc.ca>
Eric Schwartz (emschwar@pobox.com) wrote:
: Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
: > shrek11001 wrote:
: >> e.g.
: >> $x =~ /A/g;
: >> This var would provide the number of occurences of A in $x ...
: >> Does it exist ? (according to perlvar, no, but ...)
: >
: > You are asking a FAQ
: >
: > perldoc -q count
: Not *quite*. His example is a FAQ, but the general problem of, "how
: many times did this regex match?" is not one-- the FAQ only talks of
: substrings.
: my $regex = qr/(\.)\1/;
: while($string =~ $regex)
: $count++;
: }
: print "matched $count times\n";
: is one approach.
Or
$number_of_occurences_of_RE_in_x = () = $x=~m/$RE/g;
------------------------------
Date: Tue, 28 Oct 2003 00:24:25 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Is there a VAR to count the number of occurences of matching
Message-Id: <bnk9j5$11r0po$1@ID-184292.news.uni-berlin.de>
Eric Schwartz wrote:
> Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
>>shrek11001 wrote:
>>
>>>e.g.
>>> $x =~ /A/g;
>>>This var would provide the number of occurences of A in $x ...
>>>Does it exist ? (according to perlvar, no, but ...)
>>
>>You are asking a FAQ
>>
>> perldoc -q count
>
> Not *quite*. His example is a FAQ, but the general problem of, "how
> many times did this regex match?" is not one-- the FAQ only talks of
> substrings.
>
> my $regex = qr/(\.)\1/;
> while($string =~ $regex)
> $count++;
> }
> print "matched $count times\n";
>
> is one approach.
If I haven't missed anything, that approach presupposes the use of the
/g modifier, so you cannot combine it with the qr// operator. This
works though:
while($string =~ /(\.)\1/g) {
$count++;
}
print "matched $count times\n";
Note that the FAQ answer to the question "How can I count the number
of occurrences of a substring within a string?" covers that approach
as well.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 27 Oct 2003 17:28:18 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Is there a VAR to count the number of occurences of matching
Message-Id: <etoismai4t9.fsf@wormtongue.fc.hp.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
> Note that the FAQ answer to the question "How can I count the number
> of occurrences of a substring within a string?" covers that approach
> as well.
Of course it does. My excuse: I have a cold. It's either that, or
the ten million monkeys jumping up and down on my keyboard.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: 27 Oct 2003 23:40:12 +0100
From: Slaven Rezic <slaven@rezic.de>
Subject: Re: Kill forked process on Windows 2000
Message-Id: <873cdejodv.fsf@vran.herceg.de>
wherrera@lynxview.com (Bill) writes:
> Stéphane Métais <stephane.metais-pourriel@laposte.net> wrote in message news:<3f8fc6c9$0$27032$626a54ce@news.free.fr>...
> > Hello,
> >
> > I am writing a perl script using fork().
> > The parent process manages the GUI (with Tk) while the child executes
> > some work (the 2 processes communicate through a pipe)
> >
> > But i am facing 3 issues :
> > 1) When terminating, the child causes the following error :
> > Unable to register TclNotifier window class
> > Tcl_Panic at my_script line xxx.
>
> This should not happen. I'm crossposting this thread to c.l.p.tk for
> folks there to advise.
Problems with Perl/Tk and fork() are discussed in the Perl/Tk FAQ.
Look at http://www.perltk.org
Regards,
Slaven
--
Slaven Rezic - slaven@rezic.de
Berlin Perl Mongers - http://berliner.pm.org
------------------------------
Date: 27 Oct 2003 17:43:12 -0800
From: stewart@webslave.dircon.co.uk (stew dean)
Subject: Re: Perl and IIS - script runs but 'The page cannot be displayed'
Message-Id: <2b68957a.0310271743.7a08fe9b@posting.google.com>
"Tintin" <me@privacy.net> wrote in message news:<bndj0q$u62pf$1@ID-172104.news.uni-berlin.de>...
> "stew dean" <stewart@webslave.dircon.co.uk> wrote in message
> news:2b68957a.0310241707.3ad7fc65@posting.google.com...
> > ko <kuujinbo@hotmail.com> wrote in message
> news:<bn8nea$am6$1@pin3.tky.plala.or.jp>...
> > > use CGI;
> >
> > Don't use this as I write all my HTML by hand instead - just a person
> > choice thing. If it does anything more than write HTML please correct
> > me.
>
> Although the CGI module can generate HTML, the overwhelming reason people
> use it is that it handles...wait for it....CGI.
Yep - been fiddling with it. It does this very well.
Stew Dean
------------------------------
Date: 27 Oct 2003 17:58:00 -0800
From: stewart@webslave.dircon.co.uk (stew dean)
Subject: Re: Perl and IIS - script runs but 'The page cannot be displayed'
Message-Id: <2b68957a.0310271758.375dd4ee@posting.google.com>
Jim Gibson <jgibson@mail.arc.nasa.gov> wrote in message news:<271020031056574181%jgibson@mail.arc.nasa.gov>...
> In article <2b68957a.0310241707.3ad7fc65@posting.google.com>, stew dean
> <stewart@webslave.dircon.co.uk> wrote:
> [snip]
>
> > To get my script to work in the command line I created a new version -
> > one with the variables passed to the script hard coded (although there
> > are ways of doing it via the command line I've been informed) and also
> > with absolute paths rather the relative ones the server doesnt mind.
>
> Here is one suggestion: you can input the root or base directory for
> your relative paths using a command-line argument.
I really don't want to be flicking between command line and browser. I
know others don't understand this but all I want to do is run my
script without having to pass a lot of arguments using the command
line. Now maybe there's a way to emulate one script talking to
another. I personaly don't want to have to remember a string of 10
arguments (that's where I'm upto).
I want all the errors to show up in my browser or in an error log.
That's all I want now. I've been trying different solutions and so far
nothing has worked.
There's so many bits I'm not sure about - like does the STDERR include
everything you would see on the command line? Where does the STDERR go
and when is it written to? Is there a missing error log I can't see.
Thanks for taking the time to respond, it is appreciated.
Stew Dean
------------------------------
Date: 27 Oct 2003 18:00:40 -0800
From: stewart@webslave.dircon.co.uk (stew dean)
Subject: Re: Perl and IIS - script runs but 'The page cannot be displayed'
Message-Id: <2b68957a.0310271800.7d88baf3@posting.google.com>
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message news:<QAomb.1419$%e3.256@nwrddc03.gnilink.net>...
> stew dean wrote:
> > Now I'm looking for a way
> > to avoid using the command line again (except to install modules etc)
> > so I only need one script.
>
> Oh well, of course you have any right to write your programs blindfolded
> with one hand tied to your back.
What exactly do you mean by that. Appart form seeing more errors why
do need to use the command line when it means twice as much work for
me?
> But then at least neither cry for help if you can't see the bugs because of
> your blindfold nor offend those people who are telling you how to untie your
> hands.
But by using the commmand line it feels like you want to bind my legs.
Perhaps there's something you're not telling me?
Stew Dean
------------------------------
Date: Mon, 27 Oct 2003 16:02:17 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Printing folder contents
Message-Id: <slrnbpr5f9.bum.tadmc@magna.augustmail.com>
Roy Johnson <rjohnson@shell.com> wrote:
><mh> wrote in message news:<3f9d0827$1@news.dnainternet.net>...
>> my @folder = <c:\*>;
> How does it fail? What it should do is load up @folder with a listing
> of the files in c:\,
<glob> is "double quotish", so he has the equivalent of
my @folder = glob "c:\*";
which is the same as:
my @folder = glob 'c:*'; # _no_ slashes
when he wants either:
my @folder = glob "c:\\*";
or, better:
my @folder = glob "c:/*";
or, best:
my @folder = glob 'c:/*';
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 27 Oct 2003 19:26:50 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Question
Message-Id: <bnjrhq$df9$2@wisteria.csv.warwick.ac.uk>
kapavars@yahoo.com (Kobe Clinton) wrote:
> By the way,,, I don't even know how this message shot up twice on the
> board. I am using Google groups to post messages as against the
> Outlook express that I have been using until a while ago. I think that
> could be the problem.
This is not a flame, rather it is a small piece of helpful advice.
This is not a 'board', it is a newsgroup.
Don't top-post. Put your replies at the bottom, after a suitably
trimmed and attributed quote.
Many people will already have killfiled you for those mistakes :(.
Ben
--
. | .
\ / The clueometer is reading zero.
. .
__ <-----@ __ ben@morrow.me.uk
------------------------------
Date: 27 Oct 2003 19:11:01 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: strange effect with [:lower:] in perl
Message-Id: <slrnbpqre5.db9.abigail@alexandra.abigail.nl>
Alan J. Flavell (flavell@ph.gla.ac.uk) wrote on MMMDCCIX September
MCMXCIII in <URL:news:Pine.LNX.4.53.0310271613300.27527@ppepc56.ph.gla.ac.uk>:
"" On Mon, 27 Oct 2003, Abigail wrote:
""
"" > Because now you *can* do the same as with ranges: you can combine them.
"" >
"" > [a-z0-9] # Lowercase letters *and* digits.
""
"" Surely that only refers to a subset of what Unicode considers to be
"" "letters"?
Yeah, but that's what [:lower:] seems to do too:
$ perl -wle 'for (0x00 .. 0x80) {
printf "%02x %s\n", $_, chr if chr () =~ /[[:lower:]]/}'
61 a
62 b
63 c
64 d
65 e
66 f
67 g
68 h
69 i
6a j
6b k
6c l
6d m
6e n
6f o
70 p
71 q
72 r
73 s
74 t
75 u
76 v
77 w
78 x
79 y
7a z
No lowercase accented letters here.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Mon, 27 Oct 2003 19:21:57 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: strange effect with [:lower:] in perl
Message-Id: <bnjr8l$df9$1@wisteria.csv.warwick.ac.uk>
abigail@abigail.nl wrote:
> Alan J. Flavell (flavell@ph.gla.ac.uk) wrote on MMMDCCIX September
> MCMXCIII in <URL:news:Pine.LNX.4.53.0310271613300.27527@
> ppepc56.ph.gla.ac.uk>:
> "" On Mon, 27 Oct 2003, Abigail wrote:
> ""
> "" > Because now you *can* do the same as with ranges: you can combine them.
> "" >
> "" > [a-z0-9] # Lowercase letters *and* digits.
> ""
> "" Surely that only refers to a subset of what Unicode considers to be
> "" "letters"?
>
>
> Yeah, but that's what [:lower:] seems to do too:
>
> $ perl -wle 'for (0x00 .. 0x80) {
> printf "%02x %s\n", $_, chr if chr () =~ /[[:lower:]]/}'
>
<snip>
>
> No lowercase accented letters here.
Now extend that up to 0x120 or so, with perl5.8.
Ben
--
'Deserve [death]? I daresay he did. Many live that deserve death. And some die
that deserve life. Can you give it to them? Then do not be too eager to deal
out death in judgement. For even the very wise cannot see all ends.'
:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: ben@morrow.me.uk
------------------------------
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 5717
***************************************