[29529] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 773 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 20 09:09:49 2007

Date: Mon, 20 Aug 2007 06:09:15 -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, 20 Aug 2007     Volume: 11 Number: 773

Today's topics:
    Re: A question about regex anno4000@radom.zrz.tu-berlin.de
    Re: How to get "<$myclass_instance>" to work? <louisREMOVE@REMOVEh4h.com>
        MI5 Persecution: alt.fan.mike-corley 6/6/96 (3397) MI5Victim@mi5.gov.uk
        MI5 Persecution: Bernard Levin 1/6/96 (2174) MI5Victim@mi5.gov.uk
        MI5 Persecution: Fitted up 26/4/96 (951) MI5Victim@mi5.gov.uk
        MI5 Persecution: Old_500 5/7/96 (4620) MI5Victim@mi5.gov.uk
        MI5 Persecution: Silly-billy 6/7/96 (5843) MI5Victim@mi5.gov.uk
        Perl and JSP  Saran.j.jegan@gmail.com
        perl inbuilt function 'each' may be having a bug  al.moorthi@gmail.com
    Re: perl inbuilt function 'each' may be having a bug <wahab@chemie.uni-halle.de>
    Re: perl inbuilt function 'each' may be having a bug <noreply@gunnar.cc>
    Re: perl inbuilt function 'each' may be having a bug anno4000@radom.zrz.tu-berlin.de
    Re: perl inbuilt function 'each' may be having a bug <wahab@chemie.uni-halle.de>
    Re: perl inbuilt function 'each' may be having a bug <tadmc@seesig.invalid>
    Re: perl inbuilt function 'each' may be having a bug <wahab@chemie.uni-halle.de>
        set enviorment varibale  chinmoy.chittaranjan@gmail.com
    Re: set enviorment varibale <noreply@gunnar.cc>
    Re: Symbolic representation of logical operators QoS@domain.invalid
    Re: Symrefs (was: how to call sub by value in variable) <bik.mido@tiscalinet.it>
    Re: Symrefs <noreply@gunnar.cc>
    Re: Symrefs <bik.mido@tiscalinet.it>
    Re: Xah's Edu Corner: Under the spell of Leibniz's drea <quetzalcotl@consultant.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 20 Aug 2007 12:15:51 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: A question about regex
Message-Id: <5itevnF1i4ddmU1@mid.dfncis.de>

Tad McClellan  <tadmc@seesig.invalid> wrote in comp.lang.perl.misc:
> Madhusudhanan Chandrasekaran <mc79@cse.buffalo.edu> wrote:
> 
> 
> > I am a perl newbie. I am reading from a file line by line and
> > matching it for a partiuclar regex. If the match is found, I want
> > to print the previous and the next few lines.
> >
> > i.e. if the lines of the file are:
> >
> > This is a
> > String
> > But I do not
> > know how to
> > print it
> >
> >
> > and if my pattern is "But I do not", I would like to print as
> > "String But I do not know how to". Here it prints out the previous
> > and the next line, keeping it variable is desired.
> 
> 
> --------------------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
> use Tie::File;
> 
> tie my @array, 'Tie::File', 'file' or die "could not tie 'file' $!";
> my $prev = 1;
> my $next = 1;
> 
> foreach my $i ( 0 .. $#array ) {
>     next unless $array[$i] =~ /^But I do not$/;
>     print "@array[ $i-$prev .. $i+$next ]\n";
> }

Ah, that's a good use of Tie::File.  It hides the complexities of treating
a file as an array of lines (which you want to do for that problem) without
worrying about slurping the entire file.

It is still not perfect.  When the next line is "But I do not" again,
it starts another triplet that partially overlaps with the one already
printed.

There are also no provisions in case the very first (or last) line is
a match, in which cases $i-$prev or $i+$next may leave the range of
defined lines.

One solution would be to collect indices of lines to print in an array
(@print_these) and use a hash (%seen) to detect duplicates.  After the
loop, negative indices can be shifted off @print_these, and indices
beyond $#array can be popped.  Finally, @array[ @print_these] can be
output.

Anno


------------------------------

Date: Mon, 20 Aug 2007 00:50:09 -0700
From: "Wayne M. Poe" <louisREMOVE@REMOVEh4h.com>
Subject: Re: How to get "<$myclass_instance>" to work?
Message-Id: <5isveqF3r8uvqU1@mid.individual.net>

Uri Guttman wrote:
>>>>>> "k" == kj  <socyl@987jk.com.invalid> writes:
>
>  k> In <x7zm0ri5hu.fsf@mail.sysarch.com> Uri Guttman
>  <uri@stemsystems.com> writes: >> that i didn't see. but as i think
>  it is less work, tying should be on >> the table. maybe he was
> scared by what he thought it needed.
>
>  k> No, actually, it's not the amount of work that scares, but rather
>  k> the fact that I've never gotten the hang of tied variables.  For
>  k> me programming with them is always an exercise in trial and error;
>  k> I never quite know what to expect.  Too much magic for my little
>  k> brain, I guess.
>
> then you shouldn't be a programmer. in fact programming should never
> be trial and error as it is specifically meant to be deterministic by
> its very nature. :)

And who are you to tell someone they shouldn't be programming? Coming 
from someone who can't even use the stinking shift key.

> having read overload.pm and seen it in use it is the same level of
> complexity as tying but it does it from an operator point of view vs a
> variable view.

Maybe from your point of view the complexity is the same, but I get the 
feeling it's not from the OP's. He seemed to make that very clear yet 
you keep on ignoring this.

> in many ways they are very similar. they both require
> objects. i think overloading is more complex because you usually have
> to deal with 2 possible operands and how they relate based on the
> operator. with <> you only have 1 operand so it simplifies things a
> bit.

It all depends on one's background. If one is coming from a language 
like C++ then overloading will feel more natural.

-- 
Wayne 




------------------------------

Date: 20 Aug 2007 06:53:32 GMT
From: MI5Victim@mi5.gov.uk
Subject: MI5 Persecution: alt.fan.mike-corley 6/6/96 (3397)
Message-Id: <m07072010495138@4ax.com>

From: richard@musicians-net.co.uk (Richard Fairhurst)
Newsgroups: uk.misc,uk.media,uk.legal,uk.politics.misc
Subject: A Mike Corley newsgroup?
Date: Thu Jun  6 05:02:17 1996
 
In article <2520@osiris.win-uk.net>, burridge@osiris.win-uk.net (Paul
Burridge) wrote:
 
> In article <833844951snz@eloka.demon.co.uk>, Owen Lewis
(oml@eloka.demon.co.uk) writes [re: Mike Corley]:
> >To be honest, having made the mistake of reading his magnum opus twice
> >(like many forms of discomfort, one is prone to repeat the experience to
> >confirm that it really is a bad as one thought), I read nothing he writes
> >but am tempted by some of the sub-threads that develop.
>
> I made the grave error of showing one of his masterpieces to my
> mother, together with some of the (less than respectful) responses
> to it. Regrettably, she is now addicted to the Corley saga, is
> very much an admirer of him (viewing him as a pugilistic underdog
> deserving of great admiration) and I have to waste reams of paper
> printing all this bilge out every other day, for her delecation.
 
Given that Mr Corley clearly holds a certain fascination for some people,
and that his website, although "informative",  isn't  exactly  ideal  for
encouraging discussion of the sort that we all enjoy so  much  (including
Mike himself, by the look of things), would  anyone  be  up  for  a  Mike
Corley  newsgroup -  uk.fan.mike-corley,  alt.fan.mike-corley,  whatever?
(Sorry, I'm not very well up on these things.)
 
This would be a perfect place for Mike to post his writings,  and perhaps
the occasional "look at the ...mike-corley newsgroup" posting in  uk.misc
and so on would be accepted in place of the current cross-posts.
 
--
Richard Fairhurst (assistant editor, Keyboard Review)
"I am the vine: and you are the branches"

3397


--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access


------------------------------

Date: 20 Aug 2007 06:29:59 GMT
From: MI5Victim@mi5.gov.uk
Subject: MI5 Persecution: Bernard Levin 1/6/96 (2174)
Message-Id: <m07072010261958@4ax.com>

Subject: Re: "FANATIC'S FARE FOR THE COMMON MAN"
Newsgroups: uk.misc,uk.media,uk.legal,uk.politics.misc
Followup-To: uk.misc,uk.media,uk.legal,uk.politics.misc
References: <Ds0L1o.BMF.0.bloor@torfree.net> <ADCF291096681F4E@cara.demon.co.uk>
Organization: Toronto Free-Net
Distribution:
 
Peter Ceresole (peter@cara.demon.co.uk) wrote:
: In article <Ds0L1o.BMF.0.bloor@torfree.net>,
: bu765@torfree.net (Mike Corley) quoted a typical, overblown Bernard Levin
: piece, which sounds exactly like any number of other pieces by Levin over
: the past thirty years.
 
: He then goes on to draw an anguished parallel with a totally unrelated
: incident that had happened between him and a friend a few days earlier.
 
It is in the same style as his other pieces, but it's so close to what
actually happened a few days previously, that it's completely reasonable
to assume that someone told Levin about the meeting, hammed it up a
little bit and motivated him to write that article.
 
Look at the parallels;
 
1.  "madman running loose about London"
 
2.  it's about a meeting which took place recently
 
3.  the police are called (he must be controlled, however much that
consumes in resources)
 
4.  he might be violent, approach with caution, yes we're laughing but
really we're afraid of him, or is it perhaps our own propaganda that
we're letting manipulate us
 
5.   he "bursts into tears, and swears it's all true - and it is" a very
exaggerated impression of the conclusion of that meeting


Don't worry if you don't believe me, neither my friend to whom I
explained this nor my GP believe me either (until the friend found out
otherwise!). If someone just presented this to you as I am presenting it
now then I wouldn't find it credible (most likely), so it's not until you
actually find out it's true that you can find it credible. And by then
it's too late, because they've got you in their trap and explained how
"funny" the abuse is.

2174


--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access


------------------------------

Date: 20 Aug 2007 06:05:46 GMT
From: MI5Victim@mi5.gov.uk
Subject: MI5 Persecution: Fitted up 26/4/96 (951)
Message-Id: <m07072010020597@4ax.com>

Subject: Re: MI5? Please can someone explain what's going on here?
Newsgroups: uk.misc
References: <4l1khm$4cn@utopia.hacktic.nl> <4l2lhj$6h6@bignews.shef.ac.uk>
Organization: Toronto Free-Net
Distribution:
 
David Stretch (dds@leicester.ac.uk) wrote:
: In article <19960418.000817.55@hotch.hotch.demon.co.uk>,
: Iain L M Hotchkies <iain@hotch.demon.co.uk> wrote:
: >The (remote) possibility remains that 'Mike Corley' is either
: >not schizophrenic (but is 'pretending' to be so) or 'he' is
: >a product of a number of persons (?psychology students).
 
: Given other ways in which I have seen people exploit some of The Internet's
: capabilities to disrupt or indulge in sophistry, or to exploit a medium
: that resembles speech without the non-verbal and intonation cues, etc
: as a means of denigrating others, I question your use, albeit in quotes,
: of the word "remote". I'm not saying it isn't remote and therefore it is
: great, I'm just saying that I don't think we can easily classify it as
: remote, moderate, or great.
 
I think you can build up quite a good picture based on what someone says
and on their posting patterns. I don't think "The Internet" (capitals, no
less) is as opaque a medium as you make it out to be.
 
: It is not easy to determine the validity of all information on The
: Internet without making use of extra supplementary information.
 
: We do have the problem, pointed out by someone else, of the possibly
: "too perfect" textbook characteristics of what is being posted.
 
I explained that one, but I don't mind explaining it again (you don't
mind having it explained again to you, do you now?). The reason my
"symptoms" are such a perfect fit to the textbook is because the people
causing the campaign "fitted me up" in such a way that what they did
would resemble the symptoms of schizophrenia. Hence TV, radio, other
media, people in the streets etc. By a fortunate coincidence (for them)
these mthods of harassment are the ones which offer easiest channels of
access (for them).
 
It's really quite neat. All it takes is for people to start believing
that the "symptoms" aren't symptoms but reality, though, and the house of
cards collapses in a heap. And there are _lots_ of people now who knoiw
full well what has gone on.
 
: If harrassment by email, etc, has happened by someone out of the country,
: can a complaint be made that results in arrest or whatever upon that
: person's entry into the country? An interesting point which Mike may be
: able to inform us about, as he's said he will be in the UK in a few weeks
: time.
 
Picture the scene at the airport;
"I arrest you for being Mike Corley and mailbombing people"
 
"But my name isn't Corley. Who he? Mailbombing isn't illegal is it? You'd
have to lock up a lot of people if sending annoying email was a crime"
 
"Er....."
 
: --
: David Stretch: Greenwood Institute of Child Health, Univ. of Leicester, UK.
: dds@leicester.ac.uk     Phone:+44 (0)116-254-6100   Fax:+44 (0)116-254-4127
========================================================================

: context-free parts of articles, conversations and things-on-the-TV and
: assume they are meant for you. Mike, this is called paranoia.
 
But that's the way real abuse works, too. People interject words and
phrases into what they say which they know will have meaning for the listener.
 
And sometimes, they make it obvious. The very first evening of my job in
Oxford, we went for a drink with the technical director, and a couple
of other employees. The TD said in an "as-if" aside to one of the others,
"Is this the bloke who's been on TV?" (he said it directly in front of
me, and obviously meant mke to hear him saying it). The other person
replied, "Yes, I think so".
 
I think the subtext of what the TD said was "Why are they bothering with
him? He's so insignificant, why would they possibly want to spend the
resources going after him and putting all that expensive technology in
his home, when there must be much better targets?". The Technical
Director was given to sometimes disrespecting people, you see, and in my
case he couldn't see the point of anyone expending money on harassing me.

====================================================================

Subject: Re: Treatment of Schizophrenia
Newsgroups: uk.misc,uk.legal,uk.politics,alt.politics.british
Followup-To: uk.misc,uk.legal,uk.politics,alt.politics.british
References: <153321Z22041996@anon.penet.fi> <4lge6r$p00@news.ox.ac.uk>
Organization: Toronto Free-Net
Distribution:
 
Illtud Daniel (idaniel@jesus.ox.ac.uk) wrote:
: Probably 'cos you come across as reasoned & articulate, it's a pity
: about the other stuff :)
 
Veracity is so unreasonable.
 
: >>pps. You should still see a doc again Mike.
: >
: >Doing so. Trouble is, all this mental-illness stuff provides camouflage
: >for the harassment, which is real. It alows people who otherwise would
: >consider the harassment seriously to disregard it. It makes conversations
: >with a lawyer or police brief when otherwise it would merit discussion.

: The point is that there are two possibilities happening here-
 
: 1. There's a large conspiracy of people out to get you, for no
:    other reason than that they have the means to do so, and that
:    it involves a lot of the Media & a proportion of the public
 
: 2. You (who admit to having some headspace problems) are suffering
:    from acute paranoid schizophrenia.
 
: Possibility #1 is _possible_, but would be unprecendented (OTOH,
: how would we know?), unfeasible, and many other things beginning
: with _un_ which I can't think of at the moment. Besides, if there
: was something going on, chances are some of us here would know
: about it, and I'm convinced that nobody does.

"Unprecedented" hits the nail on the head. It _is_ unprecedented, but we
have only just reached the technical stage at which it is feasible, and
we know video-spying is done to other people (NB the Diana-Hewitt
episode) and is a routine tool of security agencies.
 
Perhaps what is unprecedented is not the technical side, but the social
manipulation of many people by a concealed element in what other
countries would be called the secret police. The most disturbing element
is the degree to which people allow themselves to be unquestioningly
manipulated by an evil element within the state.

951


--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access


------------------------------

Date: 20 Aug 2007 07:15:25 GMT
From: MI5Victim@mi5.gov.uk
Subject: MI5 Persecution: Old_500 5/7/96 (4620)
Message-Id: <m07072011114544@4ax.com>

From: box6565@embankment.com (Old_500)
Newsgroups: uk.misc
Subject: Dear Mike Corley
Followup-To: uk.legal,uk.misc
Date: Fri, 05 Jul 1996 15:41:16 GMT
Organization: XYz
Lines: 55
Message-ID: <31dd3788.8481134@news.dircon.co.uk>
NNTP-Posting-Host: gw1-073.pool.dircon.co.uk
X-Newsreader: Forte Agent .99e/16.227


==================================================

Subject: Now we tell the truth as it really is
Newsgroups: uk.misc
Organization: Toronto Free-Net
Summary:
Keywords:
 
 
:AND a second posting which appeared in uk.legal on 5th July 1996  (isn't Mr
:Corley popular ?)
 
>       Dear Mike,
 
>       I've just spoken to a man who knows and he has told me you
>       have never ever been a target.
 
>       My man knows because he once wrote a report on you after
>       you made complaints.
 
Come off it "Big Ears", if you're going to pretend someone else is giving me
advice then at least get one of your fellow coppers to write it so that it
isn't obviously written in the same style as your posts.
 
Also both your post and the one you're pretending isn't yours were posted from
pipex via news.dircon.co.uk, viz:
 
YOURS;
 
From: BigEars@technocom.com (Big Ears.)
Message-ID: <31ddacfe.7445797@news.dircon.co.uk>
NNTP-Posting-Host: gw5-072.pool.dircon.co.uk
 
"NOT YOURS";
 
From: box6565@embankment.com (Old_500)
Message-ID: <31dd3788.8481134@news.dircon.co.uk>
NNTP-Posting-Host: gw1-073.pool.dircon.co.uk
 
 
:NCIS leaks and most policemen regard it as unaccountable and occasionally
:insecure.  M Howard promises to make NCIS publicly accountable.
 
You know a lot about what policemen think, don't you?

4620


--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access


------------------------------

Date: 20 Aug 2007 07:45:57 GMT
From: MI5Victim@mi5.gov.uk
Subject: MI5 Persecution: Silly-billy 6/7/96 (5843)
Message-Id: <m07072011421525@4ax.com>

From: Mike_Corley_Fan_Club@Nut_house.org (Old_500)
Newsgroups: uk.misc,uk.legal,uk.media,alt.radio.uk,rec.arts.tv.uk.misc
Subject: MC Exposed as a Fraud
Date: Sat, 06 Jul 1996 17:01:05 GMT
Organization: Anti-Nuts Inc.
Lines: 33
Message-ID: <31de9b91.11926469@news.dircon.co.uk>
References: <Du4LqI.32o.0.bloor@torfree.net>
NNTP-Posting-Host: gw5-055.pool.dircon.co.uk
X-Newsreader: Forte Agent .99e/16.227


Sad, confused and emotional disturbed Mike Corley wrote:
 
            { snip }
 
Because he has made himself into a martyr and now he finds it impossible to
back down.  Mike's big secret has now been exposed.  He made everything up.
 
Every time Mike makes allegations against the police, MI5,
Tom-Dick-and-Harry etc. those organisations have taken people off vitally
important work to ascertain whether or not there was any substance in Mike's
ranting allegations.
 
When I'm told by someone who really does know such things that there was
never any plot to get Mike then I trust that person sufficiently enough to
accept his word.
 
The problem is Mike has escalated matters to an extreme level and like many
silly billys he will find it impossible to give up all his self created crap
and to live a normal life.  After all what can Mike do now this crap has
been exposed as untrue ?  What new cause can Mike dedicate himself to ?
(Some might read that as: who else can Mike now start upsetting ?)

So Mike write to John Major, c/o the Private Secretary, 10 Downing Street,
London SW1A 2AA and ask the Prime Minister to help you.  I'd normally
disclose his fax numbers but if I did that you might jam up the lines with
abusive postings just like you do here on Usenet.
 
Is anyone interested in joining with me to do a mass e-mailing of protests
to Anon Penet and to Toronto Free Net in an attempt to flood their computer
systems thus forcing them to seriously consider pulling the plug on Mike ?
I'm not sure but is my proposal called a "flame" ?

======================================================================

From: BigEars@technocom.com (Big Ears.)
Newsgroups: uk.misc,uk.legal,uk.media,alt.radio.uk,rec.arts.tv.uk.misc
Subject: Re: MC Exposed as a Fraud
Date: Sat Jul  6 17:34:46 1996
 
John Youles commented:
 
> I've found that torfree.net don't respond, perhaps if they got a high
> enough number of complaints they might take notice.  See their web pages
> for email addresses.
 
Perhaps we should give Mike 7 days from today (6 July 96) to come to his
senses and they start a massive multiple E-mailing campaign to Toronto Free
Net.  If all us victims send multiple copies of E-mails to the right
addresses in Toronto then perhaps the Canadians will begin to get the
appropriate message.
 
Copy e-mailed to Mike, just so he knows what is coming if he persists.
 
 
 
 Big Ears.                            Posted to uk.misc
==================================================================
 Please think of the people sleeping in shop doorways every night
==================================================================

-------------------------------------------------------------------

Subject: I'm wasting MI5's time! I should be arrested!
Newsgroups: uk.misc,uk.legal,rec.arts.tv.uk.misc,alt.journalism,alt.journalism.print,$
Organization: Toronto Free-Net
Summary:
Keywords:
 
 
It's such a pity that the Security Service has no powers of arrest. How are
they supposed to implement a proper secret police state without the ability to
snatch Joe Citizen off the street whenever they feel like it?
 
"Old_500" aka "Big Ears" aka "PC Plod" wrote:
>Every time Mike makes allegations against the police, MI5,
>Tom-Dick-and-Harry etc. those organisations have taken people off vitally
>important work to ascertain whether or not there was any substance in Mike's
>ranting allegations.
 
I see. So they're not wasting six years of manpower to persecute you. They're
wasting six years of manpower to prove I'm _not_ being persecuted.
 
I wish I was clever enough to think of something like that. I really, really do.
 
>When I'm told by someone who really does know such things that there was
>never any plot to get Mike then I trust that person sufficiently enough to
>accept his word.
 
Come on "Big Ears", why don't you admit that you made this posting? This is
exactly the same line you were feeding me a few months ago. The posts are from
the same news server, it's even the same newsreading software (Forte Agent
 .99e/16.227).
 
I'm afraid that if you friend "in the know" denied the existence of a plot then
he was being, as they say, economical with the truth. Judging by the extreme
reaction in London in May, and the panic you're showing now, as well as the
replay post yesterday, I would say that things are hotting up again. But for
you this time, not for me. I am out of harm's way, and there is very little you
can do as long as I stay out of the UK.

5843


--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access


------------------------------

Date: Mon, 20 Aug 2007 07:29:30 -0000
From:  Saran.j.jegan@gmail.com
Subject: Perl and JSP
Message-Id: <1187594970.695753.159150@x40g2000prg.googlegroups.com>

Hello,

          we have developed an web based application for monitoring
and controlling some machines using Java & JSP in apache tomcat, now
we have planned to replace some java programs such as serial port
communications and socket level communication with CGI scripts using
perl & c , Hope it will be faster than old java codes,Am in need to
know inserting CGI is advisable and whether it will be faster &
reliable, can any suggest your experience in similar cases



------------------------------

Date: Mon, 20 Aug 2007 03:22:35 -0700
From:  al.moorthi@gmail.com
Subject: perl inbuilt function 'each' may be having a bug
Message-Id: <1187605355.900964.200000@x40g2000prg.googlegroups.com>

Hi,
 This code is not working and assigning values to '' , actually it
shouldn't.
 #!/usr/bin/perl
use strict;
use warnings;

my %x= (a=>{a=>1,b=>2}, c=>3);
foreach (0..3) {
   my($a,$b) = each %{$x{a}};
   print "A = '$a', B = '$b'\n";
}
exit(0);

perl each-bug.pl
OUTPUT IS:
A = 'a', B = '1'
A = 'b', B = '2'
Use of uninitialized value in concatenation (.) or string at each-
bug.pl line 8.
Use of uninitialized value in concatenation (.) or string at each-
bug.pl line 8.
A = '', B = ''
A = 'a', B = '1'



------------------------------

Date: Mon, 20 Aug 2007 12:43:03 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: perl inbuilt function 'each' may be having a bug
Message-Id: <fabr6j$qko$1@nserver.hrz.tu-freiberg.de>

al.moorthi@gmail.com wrote:
> This code is not working and assigning values to '' , actually it
> shouldn't.

It does what it "should", imho.

>  #!/usr/bin/perl
> use strict;
> use warnings;
> 
> my %x= (a=>{a=>1,b=>2}, c=>3);
> foreach (0..3) {

The hash $x{$a} has only 2 elements,
the foreach (0..3) are *more* than this

>    my($a,$b) = each %{$x{a}};
>    print "A = '$a', B = '$b'\n";

  ...
  my %x = ( a =>
               { a => 1,
                 b => 2
               },
            c => 3
         );

  for (0 .. keys(%x) - 1) { # implicit "scalar keys(...)"
     my ($a, $b) = each %{ $x{a} };
     print "A = '$a', B = '$b'\n"
  }


Regards

M.


------------------------------

Date: Mon, 20 Aug 2007 12:46:36 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: perl inbuilt function 'each' may be having a bug
Message-Id: <5it9omF3rojqdU1@mid.individual.net>

al.moorthi@gmail.com wrote:
>  This code is not working and assigning values to '' , actually it
> shouldn't.

Why shouldn't it behave in accordance with the documentation? From 
"perldoc -f each":
"When the hash is entirely read, a null array is returned in list context"

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: 20 Aug 2007 10:54:28 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: perl inbuilt function 'each' may be having a bug
Message-Id: <5ita74F3qtkcoU1@mid.dfncis.de>

 <al.moorthi@gmail.com> wrote in comp.lang.perl.misc:
> Hi,
>  This code is not working and assigning values to '' , actually it
> shouldn't.

It works exactly to specification.

>  #!/usr/bin/perl
> use strict;
> use warnings;
> 
> my %x= (a=>{a=>1,b=>2}, c=>3);
> foreach (0..3) {
>    my($a,$b) = each %{$x{a}};
>    print "A = '$a', B = '$b'\n";
> }
> exit(0);
> 
> perl each-bug.pl
> OUTPUT IS:
> A = 'a', B = '1'
> A = 'b', B = '2'
> Use of uninitialized value in concatenation (.) or string at each-
> bug.pl line 8.
> Use of uninitialized value in concatenation (.) or string at each-
> bug.pl line 8.
> A = '', B = ''
> A = 'a', B = '1'

Why are you using a two-level hash to demonstrate the behavior?  You're
only using the inner hash.  Here is a simplified version that behaves
exactly the same:

    my %y = ( a => 1, b => 2);

    foreach ( 0 .. 3 ) {
        my ( $a, $b) = each %y;
       print "A = '$a', B = '$b'\n";
    }

You are calling each() four times on a hash that has only two key-value
pairs.  The documentation says:

    When the hash is entirely read, a null array is returned in
    list context (which when assigned produces a false (0) value),
    and "undef" in scalar context.  The next call to "each" after
    that will start iterating again.  There is a single iterator
 
That is exactly what's happening.  The first two calls act "normally".
The you get one call that leaves $a and $b undefined.  Since you are
enforcing evaluation in string context, these look like empty strings.
Finally the iteration starts over and you see the first pair again.

Where is the bug?

Anno


------------------------------

Date: Mon, 20 Aug 2007 12:58:40 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: perl inbuilt function 'each' may be having a bug
Message-Id: <fabs3s$quu$1@nserver.hrz.tu-freiberg.de>

al.moorthi@gmail.com wrote:
> This code is not working and assigning values to '' , actually it
> shouldn't.

It does what it "should", imho.

> my %x= (a=>{a=>1,b=>2}, c=>3);
> foreach (0..3) {
The whole hash has only 2 elements,
the hashref $x{$a}  points to twe
elements, but the foreach (0..3) are
*more* than two.

>    my($a,$b) = each %{$x{a}};
>    print "A = '$a', B = '$b'\n";
> }
> exit(0);

At first, I didn't understand your intention
and posted a irrelevant response (which I
canceled). What I think now what you should
do in order to get along - is sth. like this:

  ...

  my %x = ( a =>
               { a => 1,
                 b => 2
               },
            c => 3
         );

  for ( keys %x ) {
    # print the outer hash as it is
    print "k=$_, v=$x{$_}\n";

    # check if the hash value is a hashref
    if( UNIVERSAL::isa $x{$_},'HASH' ) {
       # and bump along
       while ( my ($a, $b) = each %{ $x{a} } ) {
          print "\tA = '$a', B = '$b'\n";
       }
    }

  }

 ...

Regards

M.


------------------------------

Date: Mon, 20 Aug 2007 05:59:59 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: perl inbuilt function 'each' may be having a bug
Message-Id: <slrnfcit1f.ro8.tadmc@tadmc30.sbcglobal.net>

al.moorthi@gmail.com <al.moorthi@gmail.com> wrote:

>  This code is not working 


It is doing exactly what it is supposed to do.

If you want us to help you modify it to do something else,
then you need to share what it is that you want it to do instead.


> and assigning values to '' , actually it
> shouldn't.
>  #!/usr/bin/perl
> use strict;
> use warnings;
>
> my %x= (a=>{a=>1,b=>2}, c=>3);
> foreach (0..3) {
>    my($a,$b) = each %{$x{a}};
>    print "A = '$a', B = '$b'\n";
> }
> exit(0);
>
> perl each-bug.pl
> OUTPUT IS:
> A = 'a', B = '1'
> A = 'b', B = '2'


Normal output so far.


> Use of uninitialized value in concatenation (.) or string at each-
> bug.pl line 8.
> Use of uninitialized value in concatenation (.) or string at each-
> bug.pl line 8.
> A = '', B = ''


From "perldoc -f each":

   When the hash is entirely read, a null array is returned in list context
   ...

> A = 'a', B = '1'

   ... The next call to C<each> after that will start iterating again.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Mon, 20 Aug 2007 12:59:06 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: perl inbuilt function 'each' may be having a bug
Message-Id: <fabshv$qvg$1@nserver.hrz.tu-freiberg.de>

Mirco Wahab wrote:
>       while ( my ($a, $b) = each %{ $x{a} } ) {
>          print "\tA = '$a', B = '$b'\n";
>       }

WTF!

Must of course read ($_ instead of 'a'):
         ...
         while ( my ($a, $b) = each %{ $x{$_} } ) {
         ...

Sorry

M.


------------------------------

Date: Mon, 20 Aug 2007 09:47:42 -0000
From:  chinmoy.chittaranjan@gmail.com
Subject: set enviorment varibale
Message-Id: <1187603262.066105.273940@i38g2000prf.googlegroups.com>

Hi All,

            I am very new to perl .Actually i want to set a enviorment
variable thorugh perl script .
e.g.->set build =1;means this variable will be set by my perl script.
So could you please help on this matter ?

Your inputs are most welcome

Thanks
Chinmoy



------------------------------

Date: Mon, 20 Aug 2007 12:01:54 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: set enviorment varibale
Message-Id: <5it74sF3r4dadU2@mid.individual.net>

chinmoy.chittaranjan@gmail.com wrote:
>             I am very new to perl .Actually i want to set a enviorment
> variable thorugh perl script .
> e.g.->set build =1;means this variable will be set by my perl script.
> So could you please help on this matter ?

     $ENV{build} = 1;

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Mon, 20 Aug 2007 10:23:13 GMT
From: QoS@domain.invalid
Subject: Re: Symbolic representation of logical operators
Message-Id: <lYdyi.1512$4K6.1387@trnddc02>


markhobley@hotpop.deletethisbit.com (Mark Hobley) wrote in message-id:  <1l1mp4-ifu.ln1@neptune.markhobley.yi.org>

> 
> Some logical operators have symbolic representation. For example:
> 
> The doubleampersand && represents the "and" operator
> The doublepipe || represents the "or" operator
> The pling ! represents the "not" operator
> 
> What is the symbolic representation for the "xor" operator?
> I don't appear to be able to find this in any documentation.
> 
> Regards,
> 
> Mark.
> 
> -- 
> Mark Hobley
> 393 Quinton Road West
> QUINTON
> Birmingham
> B32 1QE
> 
> Email: markhobley at hotpop dot donottypethisbit com
> 
> http://markhobley.yi.org/

#nand gates allow the construction of any of the logical operators.
my $a = 1;
my $b = 1;
my ($o1, $o2, $o3, $o4,);

#o4 is the result of $a xor $b;
$o1 = $a !& $b;
$o2 = $a !& $o1;
$o3 = $b !& $o1;
$o4 = $o2 !& $o3;






------------------------------

Date: Mon, 20 Aug 2007 10:28:30 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Symrefs (was: how to call sub by value in variable)
Message-Id: <3hjic3tkfdt228jhu0i399n2o7kbdt34lh@4ax.com>

On Mon, 20 Aug 2007 05:21:03 +0200, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:

>Considering the numerous postings in this group that warn for using 
>symrefs, I'm surprised to see that and other comments in this thread. Is
>
>     perldoc -q "variable name"
>
>totally out of date?

The general rule is: don't use symrefs if you don't know what you're
doing. But if you know what you're doing and you're doing it properly,
then what's the problem. Trying to circumvent that with clumsy
workaround doesn't seem that smart after all.


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, 20 Aug 2007 11:59:05 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Symrefs
Message-Id: <5it6vjF3r4dadU1@mid.individual.net>

Michele Dondi wrote:
> On Mon, 20 Aug 2007 05:21:03 +0200, Gunnar Hjalmarsson
> <noreply@gunnar.cc> wrote:
>> Considering the numerous postings in this group that warn for using 
>> symrefs, I'm surprised to see that and other comments in this thread. Is
>>
>>     perldoc -q "variable name"
>>
>> totally out of date?
> 
> The general rule is: don't use symrefs if you don't know what you're
> doing. But if you know what you're doing and you're doing it properly,
> then what's the problem.

I'm not sure; Was rather referring to the numerous opinionated posters 
in this group who basically say: "Do not use symrefs - they are bad".

> Trying to circumvent that with clumsy
> workaround doesn't seem that smart after all.

That's very true in any case.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Mon, 20 Aug 2007 13:50:30 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Symrefs
Message-Id: <dtvic3hh7mc2f4nmrqugnr8t954g44rusj@4ax.com>

On Mon, 20 Aug 2007 11:59:05 +0200, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:

>> The general rule is: don't use symrefs if you don't know what you're
>> doing. But if you know what you're doing and you're doing it properly,
>> then what's the problem.
>
>I'm not sure; Was rather referring to the numerous opinionated posters 
>in this group who basically say: "Do not use symrefs - they are bad".

Yes of course: if you see the OP has no clue then you just tell her
not to use symrefs, they're bad. It's a first order approximation. The
next few terms are null, and then at some point you have a non-null
one: that's precisely where they *are* useful.


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, 20 Aug 2007 01:23:13 -0700
From:  Ingo Menger <quetzalcotl@consultant.com>
Subject: Re: Xah's Edu Corner: Under the spell of Leibniz's dream
Message-Id: <1187598193.118227.270460@19g2000hsx.googlegroups.com>

On 20 Aug., 01:56, Xah Lee <x...@xahlee.org> wrote:

> (for you math illiterates out there: ...
> (for you mathematicians out there: ...

Please, Xah Lee, could you possibly stop to "explain" things that are
absolutely trivial? If somebody has doubts about the etymology of a
word, he may use the dictionary, or he could ask.




------------------------------

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 773
**************************************


home help back first fref pref prev next nref lref last post