[29430] in Perl-Users-Digest
Perl-Users Digest, Issue: 674 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 23 16:09:56 2007
Date: Mon, 23 Jul 2007 13:09:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 23 Jul 2007 Volume: 11 Number: 674
Today's topics:
Re: @arts <vronans@nowheresville.spamwall>
Re: @arts (Alan Curry)
Re: @arts <jurgenex@hotmail.com>
Re: @arts <bik.mido@tiscalinet.it>
Re: [OT] misc (was: Re: @arts) <bik.mido@tiscalinet.it>
Re: A perl issue when execute system call <jeanwelly@gmail.com>
Exists a Perl Module for make a SSH Tunnel ? <rafael.avaria@gmail.com>
Re: Exists a Perl Module for make a SSH Tunnel ? <m@rtij.nl.invlalid>
Re: FAQ 4.53 How do I manipulate arrays of bits? <savagebeaste@yahoo.com>
hash question <a@mail.com>
Re: hash question (Jens Thoms Toerring)
Re: In deep complex XML <paduille.4061.mumia.w+nospam@earthlink.net>
Re: Math <blb8@po.cwru.edu>
Re: Math <bik.mido@tiscalinet.it>
Re: perl IRC <glex_no-spam@qwest-spam-no.invalid>
Re: perl IRC <sow@sow.org.pl>
Re: perl IRC <blb8@po.cwru.edu>
regex question new2perl@gmail.com
Re: regex question <noreply@gunnar.cc>
Re: regex question <glennj@ncf.ca>
Re: removing . from a string <savagebeaste@yahoo.com>
Re: removing . from a string <kkeller-usenet@wombat.san-francisco.ca.us>
Re: removing . from a string <spamtrap@dot-app.org>
Re: removing . from a string <savagebeaste@yahoo.com>
Re: Small script on OpenBSD <blb8@po.cwru.edu>
Re: What to do about memory leaks <savagebeaste@yahoo.com>
Re: wors on active perl but not on unix <blb8@po.cwru.edu>
Re: XML::Twig segfault on solaris <braindumped@expires-31-07-2007.news-group.org>
Re: XML::Twig segfault on solaris <xmltwig@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 23 Jul 2007 09:12:59 -0700
From: "Vronans" <vronans@nowheresville.spamwall>
Subject: Re: @arts
Message-Id: <stWdnU6lh7UNTjnbnZ2dnUVZ_jqdnZ2d@wavecable.com>
Michele Dondi wrote:
> On Mon, 23 Jul 2007 01:13:01 -0700, "Vronans"
> <vronans@nowheresville.spamwall> wrote:
>> "Wade Ward" <zaxfuuq@invalid.net> wrote in message
>> news:2J6dnRlDn_V7KD7bnZ2dnUVZ_v2unZ2d@comcast.com...
>>> "Tad McClellan" <tadmc@seesig.invalid> wrote in message
(Please don't leave quotes without their applicable attributions.)
>>>> Please share your knowledge with me then.
>>> Believe it or not, I didn't start this thread to look like an idiot,
>>> although I seem to have achieved this.
>>
>> There are some here which chose to treat you as such, rather then
>
> Well, being admittedly barely beyond the hello world level, asking for
> ready made code, and evidently wanting to understand it without prior
> knowledge of basic Perl somewhat justifies that.
You don't know his level of knowledge. He may certainly be new to Perl,
that doesn't make him incompetent, and simply being a beginner does NOT
justify treating people like idiots, and in fact you've perfectly
demonstrated the real problem in this group.
>> attempt to see what your problem really was*, one of which
>> conveniently snipped the part** of your post that described why you
>> thought @arts was
>
> I addressed all three points. Anyway, some knowledge of *basic* Perl
> wouldn't have raised the one you're stressing.
I never said you didn't. But seeing as you snipped the attribution
(reinserted) which would of made that clear...
>> ** There really was no reason to remove that part, unless one is too
>> busy thinking up their next clever quip.
>
> I didn't remove it.
See last previous response.
>>>> Which one of those looks like @arts to you?
>>
>> You missed his point entirely (see quoted text from OP's original
>> post.)
>
> No, he didn't, quoted text from the OP's OP notwithstanding.
Oh so now you admit I wasn't addressing you. How nice of you.
> It just doesn't "look like" any (array) special variable:
> cum grano salis, obvioulsy - because "to look like" is
> subjective.
So what? Why would it REALLY matter if it doesn't look like a special
variable to any of us who know better? He didn't know, to him, the way
it was being used (see code quoted directly below), looked special. Who
the hell are you to imply what the OP thought, especially when he
already put such forth, and it was snipped with out any regard.
>> The root of his problem seems to be with this line:
>> ==> my ($since, @arts)=time-10*60*60;
>>
>> This construct doesn't seem to make sense to me, as the array does
>> not
>
> Sorry for you. It does for me, if you don't like it just remove it.
Thanks for actually addressing the question...
>> appear to be used at all:
>
> In fact, it's declared but not really used. Should it have? Why so, my
> lord? It's used a few lines later -where it makes sense to use it-,
> and it's declared as closely as possible to where it's used, which is
> what we always recommend. So what?
I know it's declared, but the point was why use would it have IN THAT
PLACE. The fact that it was declared was NEVER the issue. If you and
others weren't so busy displaying just how much 'higher' then everyone
you are you may have caught that.
>> As the OP pointed out (see quote above), the result of
>> 'time-10*60*60' is a scalar, so is there any reason why an array
>> would be used in such a place? It seems pointless to me, but I admit
>> there could be some
>
> Yes, the alternative would have been:
>
> my $since=time-10*60*60;
> my @arts;
>
> which takes more typing, more vertical space, one more statement and
> doesn't give any more readability.
Actually I'd wager that it does make it more clearer to more people than
the previous version. The previous version, while saving a line, can be
difficult to parse by the untrained mind (or even a more trained one at
first glance.) Normally when one declares a list of variables and throws
in an assignment, one assigns a list, not a scalar, as well. Assigning a
scalar instead can be useful in this case, but you should be surprised
when someone gets confused who has not touched on advanced use of
otherwise trivial constructs.
OTOH, was has to learn somewhere, though I'm sure how that warrents
treating someone as inferior.
------------------------------
Date: Mon, 23 Jul 2007 18:17:34 +0000 (UTC)
From: pacman@TheWorld.com (Alan Curry)
Subject: Re: @arts
Message-Id: <f82rbu$273$1@pcls4.std.com>
In article <ua09a3de7q76umtils6ae1fqht2r58a2e9@4ax.com>,
Michele Dondi <bik.mido@tiscalinet.it> wrote:
>On Mon, 23 Jul 2007 01:13:01 -0700, "Vronans"
><vronans@nowheresville.spamwall> wrote:
>
>>The root of his problem seems to be with this line:
>> ==> my ($since, @arts)=time-10*60*60;
>>
>>This construct doesn't seem to make sense to me, as the array does not
[...]
>>As the OP pointed out (see quote above), the result of 'time-10*60*60'
>>is a scalar, so is there any reason why an array would be used in such a
>>place? It seems pointless to me, but I admit there could be some
>
>Yes, the alternative would have been:
>
> my $since=time-10*60*60;
> my @arts;
>
>which takes more typing, more vertical space, one more statement and
>doesn't give any more readability.
Actually I think that does add readability. With the original, if you're
interested in the initial value of @arts, you have to mentally parse the time
expression first, just to find out there's nothing there initializing @arts.
Here's another variation:
my ($since, @arts)=(time-10*60*60, ());
This way there's a clear correspondence of terms on the left and right, and
the empty parentheses correspond to @arts, and you still got it packed all in
one statement.
--
Alan Curry
pacman@world.std.com
------------------------------
Date: Mon, 23 Jul 2007 19:07:57 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: @arts
Message-Id: <h07pi.6971$XL4.5446@trndny04>
Alan Curry wrote:
> Michele Dondi <bik.mido@tiscalinet.it> wrote:
>> Yes, the alternative would have been:
>>
>> my $since=time-10*60*60;
>> my @arts;
>>
>> which takes more typing, more vertical space, one more statement and
>> doesn't give any more readability.
>
> Actually I think that does add readability. With the original, if
> you're interested in the initial value of @arts, you have to mentally
> parse the time expression first, just to find out there's nothing
> there initializing @arts.
I strongly agree!
> Here's another variation:
>
> my ($since, @arts)=(time-10*60*60, ());
>
> This way there's a clear correspondence of terms on the left and
> right, and the empty parentheses correspond to @arts, and you still
> got it packed all in one statement.
A tad to confusing to me (packing too much stuff into a single statement).
jue
------------------------------
Date: Mon, 23 Jul 2007 21:44:28 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: @arts
Message-Id: <gau9a3dob7vjg5lglvtr2qnbo4op5kdb03@4ax.com>
On Mon, 23 Jul 2007 09:12:59 -0700, "Vronans"
<vronans@nowheresville.spamwall> wrote:
>(Please don't leave quotes without their applicable attributions.)
Why not? I was only addressing directly what you wrote, leaving *some*
quotes just to show, in some cases, that you were replying to someone
who was replying to someone who wrote something. But I didn't enter in
a delicate philological argumentation about who precisely wrote what.
Of course I'm false and bastard and deceipt is my most powerful
weapon: since my priority is to treat newbies like idiots and spread
lies, there was a secret plot you don't know about... HAHAHA!
>>>>> Please share your knowledge with me then.
>>>> Believe it or not, I didn't start this thread to look like an idiot,
>>>> although I seem to have achieved this.
Not hard to know recognize the last two lines as Merril's: how strange
that he recognizes having acted like an idiot in the first place,
before you poo^Hpped out of hammerspace to "defend" him...
>> Well, being admittedly barely beyond the hello world level, asking for
>> ready made code, and evidently wanting to understand it without prior
>> knowledge of basic Perl somewhat justifies that.
>
>You don't know his level of knowledge. He may certainly be new to Perl,
I *do* know his level of knowledge: I didn't come out of the factory
with full Perl knowledge preinstalled. I had to learn it. So I have
been at that level before. And I'm still learning. Strangely enough,
I've learnt more from the dirty bastards known as the regulars here
than from anyone else.
Said this, there are newbies who act like idiots and newbies who
don't. Newbies who get treated like idiots and newbies who don't.
Generally, with a strong cause-effect relationship based on the
obvious correspondence between the two.
>that doesn't make him incompetent, and simply being a beginner does NOT
>justify treating people like idiots, and in fact you've perfectly
In fact it doesn't seem to me that he treated people like idiots,
well: not here. In fact he was always very kind and polite.
>demonstrated the real problem in this group.
Yeah, it's been said before. You all ranters should join and make a
party. (Either political or the other way, whichever you like best - I
suggest D+B for the music in both cases.) FWIW I've ranked rather high
amongst top 10 clpmisc turds. I still wonder how precisely the little
troll (and "someone else") contributed positively to the group, BTW...
>> I addressed all three points. Anyway, some knowledge of *basic* Perl
>> wouldn't have raised the one you're stressing.
>
>I never said you didn't. But seeing as you snipped the attribution
>(reinserted) which would of made that clear...
I never said you said I didn't. We're simply a community, and anyone
is free to contribute to the extent she likes. My claim still stands:
knowledge of *basic* Perl wouldn't have raised the particular point.
Also, if a theorem asserts that e.g. "all three conditions" are
satisfied, then just showing that one of them is not disproves the
theorem as a whole. It is much similar here: the OP had three points,
each of them too weak. Did Tad address one? it was enough!
>>>>> Which one of those looks like @arts to you?
>>>
>>> You missed his point entirely (see quoted text from OP's original
>>> post.)
>>
>> No, he didn't, quoted text from the OP's OP notwithstanding.
>
>Oh so now you admit I wasn't addressing you. How nice of you.
I didn't claim the contrary. I'm not so susceptible to *alleged*
personal attacks...
And Tad didn't miss the point: you're acting much like those students
who have done a wrong exercise and go to the teacher to say: "but you
didn't understand my reasononing..." Whatever... if the result is
wrong, it's wrong. Basic logic, basic logic. No matter what Merril's
reasoning was: @arts looks like no predefined array variable.
>> It just doesn't "look like" any (array) special variable:
>> cum grano salis, obvioulsy - because "to look like" is
>> subjective.
>
>So what? Why would it REALLY matter if it doesn't look like a special
>variable to any of us who know better? He didn't know, to him, the way
Well, I wrote "cum grano salis", just to be safe: but I bet even my
mom would not find @arts NOT to look like any of the predefined array
variables... Please adopt some grains of salt too!
>it was being used (see code quoted directly below), looked special. Who
No, it doesn't look special in any way. It's only special in causing
me a deflagrant orchitis because of your paranoic crusade.
>> In fact, it's declared but not really used. Should it have? Why so, my
>> lord? It's used a few lines later -where it makes sense to use it-,
>> and it's declared as closely as possible to where it's used, which is
>> what we always recommend. So what?
>
>I know it's declared, but the point was why use would it have IN THAT
>PLACE. The fact that it was declared was NEVER the issue. If you and
BECAUSE IF NOT IN THAT PLACE, THE LINE BELOW. The line above is
already a declaration. I see no reason to have two separate
declarations where one would suffice. It is common practice. One of
the variables is also initalized. It is also common practice to
initialize only some variables when declaring several, within the
limits of the expressive power of the language. So I did, huh!
>others weren't so busy displaying just how much 'higher' then everyone
>you are you may have caught that.
No, we caught it, but as too good a person, at least wrt the rest of
us, you probably just can't understand how well does it make you feel
to show how higher you are...
>> Yes, the alternative would have been:
>>
>> my $since=time-10*60*60;
>> my @arts;
>>
>> which takes more typing, more vertical space, one more statement and
>> doesn't give any more readability.
>
>Actually I'd wager that it does make it more clearer to more people than
>the previous version. The previous version, while saving a line, can be
Yes, more clear to a complete Perl non-knower. Who wouldn't understand
what that @ means anyway.
>difficult to parse by the untrained mind (or even a more trained one at
>first glance.) Normally when one declares a list of variables and throws
No, just as easy for a *minimally* trained mind.
>in an assignment, one assigns a list, not a scalar, as well. Assigning a
In fact a list is assigned, containing only one element.
If you for some reason think that it *improves* readability, add a
pair of parens:
my ($since, @arts)=(time-10*60*60);
>scalar instead can be useful in this case, but you should be surprised
>when someone gets confused who has not touched on advanced use of
>otherwise trivial constructs.
"Advanced"? You must be a comedian! Would you really regard that as
"advanced"?!?
>OTOH, was has to learn somewhere, though I'm sure how that warrents
>treating someone as inferior.
Huh?!?
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: Mon, 23 Jul 2007 16:01:42 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: [OT] misc (was: Re: @arts)
Message-Id: <u4d9a3p0d0lualb5pqq5adces49gnp4dmd@4ax.com>
On Mon, 23 Jul 2007 13:10:34 +0200, Michele Dondi
<bik.mido@tiscalinet.it> wrote:
>them, which is the case with horizontal space, e.g. below some commas
^^^^^^^^^^ ^^^^^
^^^^^^^^^^ ^^^^^
Grr!
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: Mon, 23 Jul 2007 13:10:31 -0000
From: jeanwelly <jeanwelly@gmail.com>
Subject: Re: A perl issue when execute system call
Message-Id: <1185196231.740429.51490@z28g2000prd.googlegroups.com>
On Jul 20, 11:51 pm, jeanwelly <jeanwe...@gmail.com> wrote:
> Hi Glenn,
> Actually I was using `which upd` to got the full datapath of clearcase
> bin/upd command, when I debug, I found similar hang issue of `which
> whois`, due to different server setup, I can't rely on the PATH to
> tell where is the bin/upd.
>
> The interesting thing is in SUN server1 I have the issue, but no in
> SUN server2, and the two with same kernel version and perl verison.
>
> On 7 20 , 10 27 , Glenn Jackman <gle...@ncf.ca> wrote:
>
> > At 2007-07-20 07:05AM, "jeanwelly" wrote:
>
> > > > >> jeanwelly wrote:
> > > > >>> my $result = `which command`;
> > > > >>> print "Stop...\n"; # can not call to here.
> > > > >>> chomp($result);
>
> > > Sorry for not presented my problem clearly, here is clarification.
> > > `which whois`; # it will hang.
>
> > > It is executed in SUN UNIX OS, and some seems fine, some no; if key
> > > the command in shell directly, it tell me "shell built in command" in
> > > the issued SUN server; while in another SUN server that without this
> > > hang issue, the shell tells me the correct directory.
>
> > What shell do you use that has whois as a builtin command?
>
> > Doesn't 'which' read your .cshrc to learn about aliases? Do you have
> > anything in .cshrc that might be interfering?
>
> > Anyway, you shouldn't be relying on the PATH in a Perl program -- it's a
> > security issue. Either specify the full path /usr/bin/whois where you
> > need it, or set $ENV{PATH} yourself to something like '/usr/bin:/bin'.
>
> > --
> > Glenn Jackman
> > "You can only be young once. But you can always be immature." -- Dave Barry
Anyone has any suggestions to check? I'm still in the trouble. :(
One of my workmate can use his account in the server (I encountered
with hang issue) with NO the hang issue. I sourced his .cshrc, but
still does not work.
------------------------------
Date: Mon, 23 Jul 2007 14:03:44 -0000
From: lala4life <rafael.avaria@gmail.com>
Subject: Exists a Perl Module for make a SSH Tunnel ?
Message-Id: <1185199424.646235.206540@q75g2000hsh.googlegroups.com>
Hi
someone could tell me if exists a perl module to create a SSH
Tunnel or SSH port forwarding ( using password authentication or
pubic key authentication ), without using third applications.
I need to open a Tunnel for a MySQL Connection.
I am developing over windows XP, and currently open a Putty session
(with user and password ) to a remote host with a SSH Tunnel, before
calling my application.
Thanks.
------------------------------
Date: Mon, 23 Jul 2007 21:26:26 +0200
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: Exists a Perl Module for make a SSH Tunnel ?
Message-Id: <pan.2007.07.23.19.26.57@rtij.nl.invlalid>
On Mon, 23 Jul 2007 14:03:44 +0000, lala4life wrote:
> Hi
> someone could tell me if exists a perl module to create a SSH
> Tunnel or SSH port forwarding ( using password authentication or pubic
> key authentication ), without using third applications.
>
> I need to open a Tunnel for a MySQL Connection.
>
> I am developing over windows XP, and currently open a Putty session
> (with user and password ) to a remote host with a SSH Tunnel, before
> calling my application.
Look at Net::SSH2, especially the tcpip and listen methods.
HTH,
M4
P.S. You should have searched CPAN yourself!
------------------------------
Date: Mon, 23 Jul 2007 10:46:24 -0700
From: "Clenna Lumina" <savagebeaste@yahoo.com>
Subject: Re: FAQ 4.53 How do I manipulate arrays of bits?
Message-Id: <5gk7rlF3gcs37U1@mid.individual.net>
PerlFAQ Server wrote:
> This is an excerpt from the latest version perlfaq4.pod, which
> comes with the standard Perl distribution. These postings aim to
> reduce the number of repeated questions as well as allow the community
> to review and update the answers. The latest version of the complete
> perlfaq is at http://faq.perl.org .
>
> --------------------------------------------------------------------
>
> 4.53: How do I manipulate arrays of bits?
>
> Use "pack()" and "unpack()", or else "vec()" and the bitwise
> operations.
>
> For example, this sets $vec to have bit N set if $ints[N] was set:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This does not seem to be the case (read on.)
> $vec = '';
> foreach(@ints) { vec($vec,$_,1) = 1 }
Correct me if I'm wrong, but, it seems you're not checking C< $ints[N]
> (or rather, C< $ints[$_] > ) at all, and thus you get a different
pattern in $vec then you would have in @ints.
It should be something like:
my $vec = '';
my @ints = qw/1 0 0 1 0 1 0 0 0 1 1 1 1 0 1 1/;
foreach (0..$#ints) { vec($vec,$_,1) = $ints[$_]; }
When you print $vec, after unpacking it correctly, you get the correct
parttern:
my $bitstring = unpack('b*', $vec); # Bit String, Ascending Order
print "$bitstring\n";
__END__
__OUTPUT__
1001010001111011
--
CL
------------------------------
Date: Mon, 23 Jul 2007 17:25:54 GMT
From: "a" <a@mail.com>
Subject: hash question
Message-Id: <Cw5pi.22$fJ5.0@pd7urf1no>
Hi
I am using object oriented Perl.
I have a class static hash variable.
sub new
{
$self->{LINKS} = %allLinks;
bless $self, $class;
return $self;
}
sub allLinks
{
-----
}
In procedure, allLinks, how can I refer to the hash $self-{LINKS}, and
append the key/value to it?
Thanks
}
------------------------------
Date: 23 Jul 2007 19:02:55 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: hash question
Message-Id: <5gkcavF3gad93U1@mid.uni-berlin.de>
a <a@mail.com> wrote:
> I am using object oriented Perl.
> I have a class static hash variable.
> sub new
> {
> $self->{LINKS} = %allLinks;
$self seems to be a hash ref, no hash. And I don't see how you
can assign a complete hash instead of a hash ref to the hash
$self references. Did you perhaps mean
$self->{ LINKS } = \%allLinks;
or also
$self = { LINKS => \%allLinks };
Or, if you want $self->{ LINKS } to be a copy of the %allLinks
hash, then use instead e.g.
$self->{ LINKS } = { ( %allLinks ) };
> bless $self, $class;
> return $self;
> }
> sub allLinks
> {
> -----
> }
> In procedure, allLinks, how can I refer to the hash $self-{LINKS}, and
> append the key/value to it?
If what you assigned to $self->{ LINKS } is a hash ref then
a simple
$self->{ LINKS }->{ key } = $value;
should do (you can even shorten the left hand side a bit but I
feel it's easier to read the way I wrote it).
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
------------------------------
Date: Mon, 23 Jul 2007 15:27:41 GMT
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: In deep complex XML
Message-Id: <NN3pi.10950$Od7.7133@newsread1.news.pas.earthlink.net>
On 07/22/2007 10:41 AM, sow wrote:
> I have problem with get specific values from xml script below:
> [ http://pastebin.mozilla.org/174383 * ]
>
> and script in perl:
>
> #!/usr/bin/perl
> use XML::Simple;
> $xml = new XML::Simple;
> $data = $xml->XMLin($ARGV[0],
> KeyAttr => {account_details => 'account_code',subscription =>
> 'service_code',session => 'currency_code'},
> ForceArray => 1,
> );
>
> foreach $e (@{$data->{account_details}->{account02}->
> {related_ani}->{subscription}->{serv04}->{session}->{QWE}})
> {
> printf "value %20s\n",$e->{amount};
> }
>
> and I've error:
> Pseudo-hashes are deprecated at ./script line 9.
> No such pseudo-hash field "account02" at ./billing2 line 9.
>
> Any advice?
>
The ForceArray => 1 option is causing this. You seem to have written
your code to not require ForceArray, but you use the option anyway.
Read up on pseudo hashes in "perldoc perlref," and use Data::Dumper to
check your hash again. No combination of options to XMLin() that I can
figure allows for "serv04" to be a key under "subscription." The QWE
element does not exist, and even if it did, would it be in uppercase?
--
* Sow sent the XML file to me in a private e-mail.
------------------------------
Date: Mon, 23 Jul 2007 17:52:47 +0000 (UTC)
From: Brian Blackmore <blb8@po.cwru.edu>
Subject: Re: Math
Message-Id: <f82pte$kl3$1@gnus01.u.washington.edu>
Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> [A complimentary Cc of this posting was sent to
> Robert Hicks
> <sigzero@gmail.com>], who wrote in article <1184809614.126019.220110@x40g2000prg.googlegroups.com>:
> > I realize that any math in Perl is probably slower than the same math
> > in "C" but I was wondering if Perl was as accurate as "C" in math
> > computations. I don't see why it wouldn't be but I thought I would ask
> > as a heavy spherical math project is on the horizon.
> For some unfathomable reasons, Perl uses non-invertible transformations
> between strings and numbers. So if your handling of numbers involves
> converting them to strings, then back, the precision will be lost.
Yes, but I would question which programming languages don't suffer
from this behavior? As is mentioned by perlnumber, converting from
floating point to string is performed by the C compiler, whence Perl
is at the mercy of the system on which it was compiled. Moreover, I
must admit a bit of childish moronicity here in claiming that I know
of no language whatsoever that stores floats with infinite
precision, whence string conversion is always faulty.
If one uses a quotient field class, well then one is doing symbolic
algebra in one way shape or form, and again I wouldn't place blame
on the Perl numeric types.
Indeed, I was also thinking of something simple like 1/3, but have
you an example of a language where "1/3"=1/3? Or are there so many
that I'm just being dim?
--
Brian Blackmore
blb8 at po dot cwru dot edu
------------------------------
Date: Mon, 23 Jul 2007 20:11:44 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Math
Message-Id: <7qr9a3hiounfpggijhjoibsd60ogmhfngq@4ax.com>
On Mon, 23 Jul 2007 17:52:47 +0000 (UTC), Brian Blackmore
<blb8@po.cwru.edu> wrote:
>Indeed, I was also thinking of something simple like 1/3, but have
>you an example of a language where "1/3"=1/3? Or are there so many
Do you mean assignment to a constant string? ;-p
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: Mon, 23 Jul 2007 09:55:17 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: perl IRC
Message-Id: <46a4c155$0$10302$815e3792@news.qwest.net>
sow wrote:
> Hi
> Who knows any IRC servers and chanels for help with perl scripts and
> exactly XML::Simle, I have serious problem but I'm not a programist,
> but I think that for professionals it will be very simle
>
Why not read the FAQ for this newsgroup and post a minimal script
showing your issue?
------------------------------
Date: Mon, 23 Jul 2007 08:06:28 -0700
From: sow <sow@sow.org.pl>
Subject: Re: perl IRC
Message-Id: <1185203188.723868.240770@n60g2000hse.googlegroups.com>
I did it 22 of July title - In deep complex XML, but nobody know sense
answer but I need to solve my problem quickly, if you are good in
XML::Simple please inform me I send you original xml file and my
script
------------------------------
Date: Mon, 23 Jul 2007 18:27:05 +0000 (UTC)
From: Brian Blackmore <blb8@po.cwru.edu>
Subject: Re: perl IRC
Message-Id: <f82rtp$kl3$4@gnus01.u.washington.edu>
sow <sow@sow.org.pl> wrote:
> I did it 22 of July title - In deep complex XML, but nobody know sense
> answer but I need to solve my problem quickly, if you are good in
> XML::Simple please inform me I send you original xml file and my
> script
Looks to me like it was indicated where the problems were with the
script you posted, but if it's a rush job (and since people here
answer questions voluntarily at their leisure) you might try
something like http://www.contractedwork.com/
--
Brian Blackmore
blb8 at po dot cwru dot edu
------------------------------
Date: Mon, 23 Jul 2007 17:22:30 -0000
From: new2perl@gmail.com
Subject: regex question
Message-Id: <1185211350.179572.165420@e9g2000prf.googlegroups.com>
Trying to match a variable such as: $name
or
a hashvar such as: $name{var1}
Tried s/\$(\w+)/g but that only matches $name.
Also tried s/\$(\w+{?\w*}? - not working.
Bob.
------------------------------
Date: Mon, 23 Jul 2007 20:26:05 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: regex question
Message-Id: <5gkac7F3hdvbqU1@mid.individual.net>
new2perl@gmail.com wrote:
> Trying to match a variable such as: $name
>
> or
>
> a hashvar such as: $name{var1}
>
>
> Tried s/\$(\w+)/g but that only matches $name.
>
> Also tried s/\$(\w+{?\w*}? - not working.
What are you trying to achieve? Are you trying to resolve variables in a
template? Perl variables are not well suited as template variables.
Anyway, to just answer your question, this would match both your examples:
\$\S+
You probably want to read this FAQ entry:
perldoc -q "expand variables"
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 23 Jul 2007 19:03:09 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: regex question
Message-Id: <slrnfa9ure.sqn.glennj@smeagol.ncf.ca>
At 2007-07-23 01:22PM, "new2perl@gmail.com" wrote:
> Trying to match a variable such as: $name
> or
> a hashvar such as: $name{var1}
>
> Tried s/\$(\w+)/g but that only matches $name.
> Also tried s/\$(\w+{?\w*}? - not working.
The problem would be the conditional braces that either have to be both
present or both absent.
Try: /\$(\w+(?:{.*?})?)/
But, what about kinds of variables: arrays, hashes, hashrefs, etc?
You're not matching: @foo, %{$foo{bar}{baz}}, etc
--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
------------------------------
Date: Mon, 23 Jul 2007 11:09:22 -0700
From: "Clenna Lumina" <savagebeaste@yahoo.com>
Subject: Re: removing . from a string
Message-Id: <5gk96nF3gpbcaU1@mid.individual.net>
Tad McClellan wrote:
> pkassies@gmail.com <pkassies@gmail.com> wrote:
>
> > I need to strip "90.00" back to "90".
>
> -------------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> my $item = "90.0";
> $item += 0;
> print "$item\n";
> -------------------------
1) This code doesn't work as expected if the fraction part is
anything other than .0 (i.e., using "90.4" will end up
printing 90.4 )
2) I thought it was generally frowned upon to quote a variable
this way, rather than, say, C< print $itme, "\n"; > or so?
--
CL
------------------------------
Date: Mon, 23 Jul 2007 11:19:39 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: removing . from a string
Message-Id: <s28fn4xdof.ln2@goaway.wombat.san-francisco.ca.us>
On 2007-07-23, Clenna Lumina <savagebeaste@yahoo.com> wrote:
> Tad McClellan wrote:
>> pkassies@gmail.com <pkassies@gmail.com> wrote:
>>
>> > I need to strip "90.00" back to "90".
>>
>> -------------------------
>> #!/usr/bin/perl
>> use warnings;
>> use strict;
>>
>> my $item = "90.0";
>> $item += 0;
>> print "$item\n";
>> -------------------------
>
> 1) This code doesn't work as expected if the fraction part is
> anything other than .0 (i.e., using "90.4" will end up
> printing 90.4 )
The ''spec'' doesn't say what to expect for 90.4. If the OP wants to
round 90.4 down to 90, he should say so. But if he wants to modify
only values where the decimal part equals zero, Tad's solution is both
efficient and readable.
> 2) I thought it was generally frowned upon to quote a variable
> this way, rather than, say, C< print $itme, "\n"; > or so?
I've not heard such a convention. It's frowned upon to double-quote a
string with no variables, but double-quoting a string with variables is
perfectly fine. It's certainly easier (IMO) to read
print "The value of item is $item\n";
than
print 'The value of item is ', item, "\n";
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information
------------------------------
Date: Mon, 23 Jul 2007 14:33:31 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: removing . from a string
Message-Id: <m27iorvukk.fsf@dot-app.org>
"Clenna Lumina" <savagebeaste@yahoo.com> writes:
> Tad McClellan wrote:
>
>> print "$item\n";
>
> 2) I thought it was generally frowned upon to quote a variable
> this way, rather than, say, C< print $itme, "\n"; > or so?
No, what's frowned upon is *unnecessary* quoting that accomplishes nothing,
as in C<print "$item", "\n";>. If you want to print a variable with a new-
line, then double-quoting is a perfectly valid way to do that.
There are certainly occasions where passing a list to print() is more
efficient and/or readable than interpolation. I wouldn't say that just
printing a single scalar followed by a newline is one of those situations
though.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Mon, 23 Jul 2007 11:39:36 -0700
From: "Clenna Lumina" <savagebeaste@yahoo.com>
Subject: Re: removing . from a string
Message-Id: <5gkavdF3g0a0dU1@mid.individual.net>
Sherm Pendley wrote:
> "Clenna Lumina" <savagebeaste@yahoo.com> writes:
>
>> Tad McClellan wrote:
>>
>>> print "$item\n";
>>
>> 2) I thought it was generally frowned upon to quote a variable
>> this way, rather than, say, C< print $item, "\n"; > or so?
>
> No, what's frowned upon is *unnecessary* quoting that accomplishes
> nothing, as in C<print "$item", "\n";>. If you want to print a
> variable with a new- line, then double-quoting is a perfectly valid
> way to do that.
>
> There are certainly occasions where passing a list to print() is more
> efficient and/or readable than interpolation. I wouldn't say that just
> printing a single scalar followed by a newline is one of those
> situations though.
Understood.
I was referring more to situations like C< my $s = "$t"; > vs C< my
$s = $t; > but I can see I may have been in error about the former
usage in terms of print and adding simply a newline. I was thinking at
the time that C< print "$item\n"; > would be better written akin to
the latter usage.
--
CL
------------------------------
Date: Mon, 23 Jul 2007 18:16:25 +0000 (UTC)
From: Brian Blackmore <blb8@po.cwru.edu>
Subject: Re: Small script on OpenBSD
Message-Id: <f82r9p$kl3$3@gnus01.u.washington.edu>
Jens Thoms Toerring <jt@toerring.de> wrote:
> sukovic@gmail.com wrote:
> > ...
> > open(F, "</proc/net/dev") || mrtg_die();
> > ...
> ...
> open my $f, "/sbin/ifconfig $if 2>/dev/null|" or die "Can't run ifconfig\n"
> ...
On OBSD, I'm using `netstat -b -n -I <interface>`. I poll several
networking interfaces at regular intervals to monitor usage, and it
has never caused unfortunate overhead nor been particularly
incorrect in its return of data.
--
Brian Blackmore
blb8 at po dot cwru dot edu
------------------------------
Date: Mon, 23 Jul 2007 11:28:28 -0700
From: "Clenna Lumina" <savagebeaste@yahoo.com>
Subject: Re: What to do about memory leaks
Message-Id: <5gkaahF3f7l48U1@mid.individual.net>
Abigail wrote:
> _
> Martin Trautmann (t-use@gmx.net) wrote on VLXXI September MCMXCIII in
> <URL:news:slrnfa15t5.otd.t-use@ID-685.user.individual.de>:
> ()
> () Hi all,
> ()
> () I got a perl script here which takes more memory than expected: It
> () starts at about 10 MB, which is ok. After half of the job (3000
> URL () checks) it got > 500 MB, further increasing up to its
> termination. I've () seen several segmentation fault errors as soon
> as the script would end, () but don't know why. It's just a while
> loop, which is processed again and () again without problems, while
> there's no more command after the end of () this loop. Maybe the
> increased memory size is related to this error. ()
> () I use strict and warnings, I verified that there was nothing
> wrong about () the variables and open/close files.
> ()
> () I take extensive use of WWW::Mechanize, without any knowledge
> what going () on inside.
> ()
> () I used Devel::Leaks in order to get the info that there's much
> going on - () but I do not know yet what to do about this kind of
> information. ()
> () What's your recommendation for a perl novice how to find out
> about these () leaks?
>
>
> Check line 17.
Check quoting delimiters.
--
CL
------------------------------
Date: Mon, 23 Jul 2007 18:07:24 +0000 (UTC)
From: Brian Blackmore <blb8@po.cwru.edu>
Subject: Re: wors on active perl but not on unix
Message-Id: <f82qos$kl3$2@gnus01.u.washington.edu>
Nospam <nospam@home.com> wrote:
> #!/usr/bin/perl
> use strict;
> use warnings;
> use Data::Dumper;
> use WWW::Mechanize;
> my $total_count = 0;
> my @keywords = ('simpsons',
> 'diehard',
> 'fantastic+four',
> );
> foreach my $keywords(@keywords){
> my $url
> ='http://news.google.co.uk/search?q=~%22'.$keywords.'&num=100&hl=en&safe=off
> &start=0&as_qdr=all&filter=0';
> my $mech = WWW::Mechanize->new();
> $mech->get($url);
die "Can't fetch: ", $mech->response->status_line unless $mech->success;
> print $mech->uri."\n";
What gets printed here?
> my @links_to_check = grep { $_->url() !~ /google/i}
> $mech->find_all_links( url_regex => qr/\./i );
> foreach my $links_to_check (@links_to_check)
> {
> $total_count++;
> print "$links_to_check \n";
> }
> }
> print " $total_count news items found \n";
> On activeperl I get approx 894 results, while on a server, I get 0 results
What happens with mech-dump from the server?
--
Brian Blackmore
blb8 at po dot cwru dot edu
------------------------------
Date: Mon, 23 Jul 2007 17:26:17 +0200
From: Thomas Peter <braindumped@expires-31-07-2007.news-group.org>
Subject: Re: XML::Twig segfault on solaris
Message-Id: <1185204377.3@user.newsoffice.de>
mirod wrote:
> I am sorry, it looks like my ISP doesn't propagate my posts, so the 2
> answers I sent earlier have been lost.
> In any case, the problem is with perl itself, in freeing variables
> after a huge number of weaken.
> I filed a bug report on Scalar::Util (http://rt.cpan.org/Ticket/
> Display.html?id=28365) and then on perl itself, as it appears that
> that's where the blame lies.
the strange thing to me is, that it works on
linux:
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
and cygwin:
This is perl, v5.8.7 built for cygwin-thread-multi-64int
but not on solaris (sparc)
This is perl, v5.8.8 built for sun4-solaris
and
This is perl, v5.8.5 built for sun4-solaris
the seg-fault appears.
------------------------------
Date: Mon, 23 Jul 2007 18:38:17 -0000
From: mirod <xmltwig@gmail.com>
Subject: Re: XML::Twig segfault on solaris
Message-Id: <1185215897.667050.274860@e9g2000prf.googlegroups.com>
On Jul 23, 8:26 am, Thomas Peter <braindum...@expires-31-07-2007.news-
group.org> wrote:
> mirod wrote:
> > I am sorry, it looks like my ISP doesn't propagate my posts, so the 2
> > answers I sent earlier have been lost.
> > In any case, the problem is with perl itself, in freeing variables
> > after a huge number of weaken.
> > I filed a bug report on Scalar::Util (http://rt.cpan.org/Ticket/
> > Display.html?id=28365) and then on perl itself, as it appears that
> > that's where the blame lies.
>
> the strange thing to me is, that it works on
> linux:
e seg-fault appears.
My guess is that the problem would probably happen in linux if you
had
a bigger file. It started at 23K nodes on my linux box.
--
mirod
------------------------------
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 V11 Issue 674
**************************************