[32105] in Perl-Users-Digest
Perl-Users Digest, Issue: 3369 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 28 14:09:28 2011
Date: Thu, 28 Apr 2011 11:09:09 -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 Thu, 28 Apr 2011 Volume: 11 Number: 3369
Today's topics:
Re: A regex to search for numeric ranges... <justin.1104@purestblue.com>
Books on C/C++ for perl programmers <taurusgemini123@gmail.com>
Re: Books on C/C++ for perl programmers <cartercc@gmail.com>
Re: Books on C/C++ for perl programmers <john@castleamber.com>
Re: Books on C/C++ for perl programmers <cartercc@gmail.com>
Re: FAQ flood MUST end <justin.1104@purestblue.com>
Re: FAQ flood MUST end <rweikusat@mssgmbh.com>
Re: FAQ flood MUST end <jurgenex@hotmail.com>
Re: FAQ flood MUST end <john@castleamber.com>
Re: FAQ flood MUST end <jurgenex@hotmail.com>
Re: Read a hash <john@castleamber.com>
Re: Read a hash <tadmc@seesig.invalid>
Re: Read a hash <tadmc@seesig.invalid>
Re: Read a hash <uri@StemSystems.com>
Re: Read a hash <bugbear@trim_papermule.co.uk_trim>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 28 Apr 2011 09:25:37 +0100
From: Justin C <justin.1104@purestblue.com>
Subject: Re: A regex to search for numeric ranges...
Message-Id: <1tkn88-69c.ln1@zem.masonsmusic.co.uk>
On 2011-04-28, Jim Gibson <jimsgibson@gmail.com> wrote:
>
> To quote Sherlock Holmes:
>
> "You see," he explained, "I consider that a man's brain originally is
> like a little empty attic, and you have to stock it with such furniture
> as you choose. A fool takes in all the lumber of every sort that he
> comes across, so that the knowledge which might be useful to him gets
> crowded out, or at best is jumbled up with a lot of other things so
> that he has a difficulty in laying his hands upon it. Now the skilful
> workman is very careful indeed as to what he takes into his
> brain-attic. He will have nothing but the tools which may help him in
> doing his work, but of these he has a large assortment, and all in the
> most perfect order. It is a mistake to think that that little room has
> elastic walls and can distend to any extent. Depend upon it there comes
> a time when for every addition of knowledge you forget something that
> you knew before. It is of the highest importance, therefore, not to
> have useless facts elbowing out the useful ones."
Now we know where Matt Groening got Homer's quote "...every time I learn
something new it pushes some old stuff out of my brain".
I should read more... but then I'd probably forget stuff I want to
remember.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Thu, 28 Apr 2011 01:27:57 -0700 (PDT)
From: l0cl <taurusgemini123@gmail.com>
Subject: Books on C/C++ for perl programmers
Message-Id: <0cba5b3f-cd2c-418d-aa52-d1c3231dbbc5@f15g2000pro.googlegroups.com>
There are many books on "perl for C/C++ programmers" but none for "C/C+
+ for perl programmers". Does anyone know of any such book or
tutorial?
Thanks in advance,
>Hanna<
------------------------------
Date: Thu, 28 Apr 2011 07:04:36 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: Books on C/C++ for perl programmers
Message-Id: <e874082b-47b8-466e-9185-11a00d8db54b@b19g2000yqg.googlegroups.com>
On Apr 28, 4:27=A0am, l0cl <taurusgemini...@gmail.com> wrote:
> + for perl programmers". Does anyone know of any such book or
> tutorial?
I don't think that they are any, but that's not a problem.
There are many, many books on C and C++, and we each have our
favorites. I can vouch personally for a dozen or so, but I won't. Most
of them will probably get you into C or C++, it depends on what flavor
you want to study.
I like the Deitel series in general, but the focus is on the beginning
programmer. Ivor Horton also wrote a book that focuses on C++ for
the .NET framework and the Microsoft CLR that IMO is a particularly
strong book, but maybe not if you like gcc.
The thing to remember about Perl and C is that Perl is written in C
and expands C greatly. Your biggest challenge with C will be memory
management and pointers, both of which Perl handles in the background.
Why do you want to learn C? If you have a reason to learn C, like
mucking around inside Linux or unix or Perl, have at it. If not, let
me suggest that Perl is probably as close to C as your likely to
really need, and you might want to consider learning another language.
'Seven Languages in Seven Weeks' by Bruce Tate is a reasonable
starting point for exploring other languages on a superficial level.
If you have need, I'd highly recommend exploring Prolog, Erlang,
Haskell, or Lisp (Clojure).
If you prefer a non-standard language, I'd recommend XSLT, R, SQL, and
even LaTeX as something that you can learn quickly and put to use in
many circumstances.
If you want to increase your appeal to employers, I'd recommend you
learn Java or C# or (maybe) Python or Ruby as up-and-coming
technologies. C doesn't make this list because it's a niche language
in industry, and C++ doesn't make the list because it requires
substantially more time and experience to master.
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
Best, CC.
------------------------------
Date: Thu, 28 Apr 2011 09:18:08 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: Books on C/C++ for perl programmers
Message-Id: <8739l231en.fsf@castleamber.com>
ccc31807 <cartercc@gmail.com> writes:
> On Apr 28, 4:27Â am, l0cl <taurusgemini...@gmail.com> wrote:
>> + for perl programmers". Does anyone know of any such book or
>> tutorial?
>
> I don't think that they are any, but that's not a problem.
The only book I know that have both in the title is "Writing Apache
Modules with Perl and C" :-)
> If you want to increase your appeal to employers, I'd recommend you
> learn Java or C# or (maybe) Python or Ruby as up-and-coming
> technologies. C doesn't make this list because it's a niche language
> in industry, and C++ doesn't make the list because it requires
> substantially more time and experience to master.
I don't think there is a programming language that is easy to master;
or: I think they are all somewhat equally hard. And I don't mean
learning the syntax, I mean knowing all ins and outs of the language and
the common libraries/modules.
> http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
Oh, please, does anyone who can actually program take that list any
serious?
--
John Bokma j3b
Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
------------------------------
Date: Thu, 28 Apr 2011 10:44:34 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: Books on C/C++ for perl programmers
Message-Id: <6791fb9c-684d-43b0-a03e-0bf15fd80bcc@l18g2000yql.googlegroups.com>
On Apr 28, 10:18=A0am, John Bokma <j...@castleamber.com> wrote:
> >http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
>
> Oh, please, does anyone who can actually program take that list any
> serious?
Hey, it is what it is, and it's worth exactly what you pay for it,
which is nothing.
My personal favorite gauge is dice.com, which tells me exactly what
technologies the HR people in my area think are important, which is
arguably more relevant to my personal situation.
CC.
------------------------------
Date: Thu, 28 Apr 2011 09:32:25 +0100
From: Justin C <justin.1104@purestblue.com>
Subject: Re: FAQ flood MUST end
Message-Id: <p9ln88-69c.ln1@zem.masonsmusic.co.uk>
On 2011-04-27, Jon Du Kim <jondk@FAKE.EMAIL.net> wrote:
> On 4/27/2011 5:56 PM, Tad McClellan wrote:
>> Jon Du Kim<jondk@FAKE.EMAIL.net> wrote:
>>>> I would hope that FAQ answers get reviewed/updated more frequently
>>>> than every 25 years!
>>> oh horseshit! That retarded "posting faq" you spam the group with
>>
>>
>> I do not post any FAQ.
> Call it whatever you want.
If you'd called it by it's name instead of using a misleading
description then we'd not have wasted our time and the discussion may
have been useful. Instead it has descended to obscenities and name
calling. Well done.
<plonk>
Justin.
--
Justin C, by the sea.
------------------------------
Date: Thu, 28 Apr 2011 13:39:23 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: FAQ flood MUST end
Message-Id: <8739l2a6tg.fsf@sapphire.mobileactivedefense.com>
Jon Du Kim <jondk@FAKE.EMAIL.net> writes:
> On 4/27/2011 5:56 PM, Tad McClellan wrote:
>> Jon Du Kim<jondk@FAKE.EMAIL.net> wrote:
>>>> I would hope that FAQ answers get reviewed/updated more frequently
>>>> than every 25 years!
>>> oh horseshit! That retarded "posting faq" you spam the group with
>>
>> I do not post any FAQ.
> Call it whatever you want. How about being open to the idea that it is
> useless in its current form and needs to be completely rewritten?
> Simply put, it reflects a very dated 90's attitude.
> usenet is a community of users, not a community of rules. whinging
> about top posting is ridiculous. The world has moved on...
JFTR: While your possibliy "very 90's dated entity" may not yet have
had any access to computers that long ago, I remember to have read
expressions of your really dated attitude, minus to 'so 1990s' tag,
obviously, in the 1990s.
[SCNR]
------------------------------
Date: Thu, 28 Apr 2011 08:33:18 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: FAQ flood MUST end
Message-Id: <7s1jr690t1qkmc81tccamq6hvo7tbc7735@4ax.com>
Jon Du Kim <jondk@FAKE.EMAIL.net> wrote:
>On 4/27/2011 5:56 PM, Tad McClellan wrote:
>> Jon Du Kim<jondk@FAKE.EMAIL.net> wrote:
>>>> I would hope that FAQ answers get reviewed/updated more frequently
>>>> than every 25 years!
>>> oh horseshit! That retarded "posting faq" you spam the group with
>>
>>
>> I do not post any FAQ.
>Call it whatever you want.
Johnston in The Last Emperor: Words are important.
Pu Yi, at 15: Why are words important?
Johnston: If you cannot say what you mean, your majesty, you will never
mean what you say and a gentleman should always mean what he says.
You may draw your own conlusions.
*PLONK*
>How about being open to the idea that it is
>useless in its current form and needs to be completely rewritten? Simply
>put, it reflects a very dated 90's attitude.
>usenet is a community of users, not a community of rules. whinging about
>top posting is ridiculous. The world has moved on...
The world is welcome to use Twitter and Facebook
jue
------------------------------
Date: Thu, 28 Apr 2011 10:54:21 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: FAQ flood MUST end
Message-Id: <87ei4mbccy.fsf@castleamber.com>
Jürgen Exner <jurgenex@hotmail.com> writes:
> The world is welcome to use Twitter and Facebook
Oh, my, please stop this elitist behavior. Personally I think Stack
Overflow (in my case) has superseded Usenet for many of the instances I
used to use Usenet usually. And Facebook has superseded some other uses
I had for Usenet.
Each new thing has its place. Looking down on it all makes you an
elitist dinosaur ready to be fossilized.
--
John Bokma j3b
Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
------------------------------
Date: Thu, 28 Apr 2011 09:19:58 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: FAQ flood MUST end
Message-Id: <tg4jr6db8o9o5cvlvs320pms6chi932o2r@4ax.com>
John Bokma <john@castleamber.com> wrote:
>Jürgen Exner <jurgenex@hotmail.com> writes:
>
>> The world is welcome to use Twitter and Facebook
>
>Oh, my, please stop this elitist behavior. Personally I think Stack
>Overflow (in my case) has superseded Usenet for many of the instances I
>used to use Usenet usually. And Facebook has superseded some other uses
>I had for Usenet.
>
>Each new thing has its place. Looking down on it all makes you an
>elitist dinosaur ready to be fossilized.
And I don't have any problems with that.
I don't ask the world to like the cosy coffee shop around the corner.
But I do have a major problem with people busting in and demanding:
"This is a great place, but the world has moved on and you should change
this into a Hard Rock Cafe."
Don't you think I would be able to find a Hard Rock Cafe if I wanted to
visit one?
jue
------------------------------
Date: Wed, 27 Apr 2011 20:15:17 -0500
From: John Bokma <john@castleamber.com>
Subject: Re: Read a hash
Message-Id: <87zknb2n2y.fsf@castleamber.com>
DanielC <dnlchen@gmail.com> writes:
> INPUT (tt):
>
> INFO - {
> 'Result' => 'failure',
> 'Id' => '1564',
> 'dataRecv' => 'adfasdfi',
> 'dataSent' => 'rqerqerer',
> 'elapsedTime' => '7.023359',
> 'externalId' => 'AI2JL4PBLG',
> 'responseCode' => '0',
> 'responseMsg' => 'n/a',
> 'sentAt' => '2011-04-27 00:08:02',
> 'serviceId' => '13',
> 'serviceName' => 'abc',
> 'timeInQueue' => 1
> }
If you have any control over the input format you might want to change
to YAML, or use Data::Dumper. I recommend/prefer the former.
--
John Bokma j3b
Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
------------------------------
Date: Wed, 27 Apr 2011 20:51:21 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Read a hash
Message-Id: <slrnirhho1.uf9.tadmc@tadbox.sbcglobal.net>
DanielC <dnlchen@gmail.com> wrote:
> On Apr 27, 5:01Â pm, Tad McClellan <ta...@seesig.invalid> wrote:
>> DanielC <dnlc...@gmail.com> wrote:
>> > Â Â %hash = $line;
>>
>> Â Â %hash = eval $line; Â # Danger Will Robinson!
> Yes, it works. I tried this before but it didn't get the right output.
> Why?
>
> %hash = eval { $line };
Perl has 2 functions that are both name "eval".
The 1st one is "eval EXPR" and the 2nd one is "eval BLOCK".
The docs for eval BLOCK explain it:
In the second form, the code within the BLOCK is parsed only once
So, after the eval BLOCK is parsed once, you have the same as:
%hash = '( key => value, other => value )';
The RHS is a single string, so you get the "odd number" warning.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.
------------------------------
Date: Wed, 27 Apr 2011 21:27:04 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Read a hash
Message-Id: <slrnirhjr1.uf9.tadmc@tadbox.sbcglobal.net>
DanielC <dnlchen@gmail.com> wrote:
> On Apr 27, 5:07Â pm, Jim Gibson <jimsgib...@gmail.com> wrote:
>> In article
>> <022eb4e5-074c-46e1-b8f7-3d872ab35...@h36g2000pro.googlegroups.com>,
>> DanielC <dnlc...@gmail.com> wrote:
>> > local $/ = "\n\n";
>> > while (my $line = <>)
Naming a variable 'line" when it does not contain a line
is a silly thing to do.
>> my %hash = ( $line =~ /'[^']*'/g );
>>
>> That probably doesn't work,
Right.
It would have been better to not post that line, as untested/unworking
code is likely to lead off into the woods rather than helping.
> Why I did "%hash = $line;" is because I had tested a script.
Huh?
That makes no sense...
> BTW, I
> don't understand - my %hash = ( $line =~ /'[^']*'/g );
The parens don't do anything, so they should not be there.
The docs for m//g (perlop.pod) say:
In list context, it returns a list of the
substrings matched by any capturing parentheses in the regular
expression. If there are no parentheses, it returns a list of all
the matched strings, as if there were parentheses around the whole
pattern.
So Jim's code will end up with keys and values with single quotes in them...
Choose a more meaningful name, remove the unneeded parens and add the
needed parens:
my %hash = $chunk =~ /'([^']*)'/g;
which ends up being:
my %hash = ('Result', 'failure','Id', '1565', ...);
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.
------------------------------
Date: Thu, 28 Apr 2011 00:39:09 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Read a hash
Message-Id: <87iptzouqa.fsf@quad.sysarch.com>
>>>>> "TM" == Tad McClellan <tadmc@seesig.invalid> writes:
TM> Choose a more meaningful name, remove the unneeded parens and add the
TM> needed parens:
TM> my %hash = $chunk =~ /'([^']*)'/g;
and that fails because of this data line:
'timeInQueue' => 1
so it will also likely spit out an odd number of hash elements warning.
one way to fix this is to make the regex grab the left part (always in
'') skip => and whitespace and then the right part which is either in ''
or a digit (word?) string. i leave it as an exercise. :)
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Thu, 28 Apr 2011 15:23:56 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Read a hash
Message-Id: <4oqdnWqzNr3h5STQnZ2dnUVZ7sKdnZ2d@brightview.co.uk>
Uri Guttman wrote:
>>>>>> "TM" == Tad McClellan<tadmc@seesig.invalid> writes:
>
> TM> Choose a more meaningful name, remove the unneeded parens and add the
> TM> needed parens:
>
> TM> my %hash = $chunk =~ /'([^']*)'/g;
>
> and that fails because of this data line:
>
> 'timeInQueue' => 1
>
> so it will also likely spit out an odd number of hash elements warning.
>
> one way to fix this is to make the regex grab the left part (always in
> '') skip => and whitespace and then the right part which is either in ''
> or a digit (word?) string. i leave it as an exercise. :)
If only there were some parser, somewhere, that could handle
this...
:-)
BugBear
------------------------------
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:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 3369
***************************************