[30311] in Perl-Users-Digest
Perl-Users Digest, Issue: 1554 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 19 00:09:40 2008
Date: Sun, 18 May 2008 21:09:07 -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 Sun, 18 May 2008 Volume: 11 Number: 1554
Today's topics:
Re: FAQ 2.11 Perl Books (David Combs)
Re: FAQ 4.41 How can I remove duplicate elements from a <uri@stemsystems.com>
Find all variables used. sharma__r@hotmail.com
Re: floating bar in the line chart (David Combs)
Re: I need ideas on how to sort 350 million lines of da xhoster@gmail.com
Re: I need ideas on how to sort 350 million lines of da <bill@ts1000.us>
Re: Need ideas on how to make this code faster than a s <uri@stemsystems.com>
Re: Order of operations (was: FAQ 4.47 How do I handle <ben@morrow.me.uk>
Re: Order of operations (was: FAQ 4.47 How do I handle <hjp-usenet2@hjp.at>
Re: Order of operations <someone@example.com>
Re: Perl 6 <john@castleamber.com>
Re: Problems with GetOpt xhoster@gmail.com
Re: Problems with GetOpt <prich@earthlink.net>
Re: Problems with GetOpt <prich@earthlink.net>
Re: The map function (David Combs)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 May 2008 03:13:21 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: FAQ 2.11 Perl Books
Message-Id: <g0qr8h$cte$1@reader2.panix.com>
In article <5jbae5-eph.ln1@blue.stonehenge.com>,
PerlFAQ Server <brian@stonehenge.com> wrote:
>This is an excerpt from the latest version perlfaq2.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 .
>
>--------------------------------------------------------------------
>
>2.11: Perl Books
>
> A number of books on Perl and/or CGI programming are available. A few of
> these are good, some are OK, but many aren't worth your money. There is
> a list of these books, some with extensive reviews, at
> http://books.perl.org/ . If you don't see your book listed here, you can
> write to perlfaq-workers@perl.org .
>
> The incontestably definitive reference book on Perl, written by the
> creator of Perl, is Programming Perl:
>
> Programming Perl (the "Camel Book"):
> by Larry Wall, Tom Christiansen, and Jon Orwant
> ISBN 0-596-00027-8 [3rd edition July 2000]
> http://www.oreilly.com/catalog/pperl3/
> (English, translations to several languages are also available)
>
> The companion volume to the Camel containing thousands of real-world
> examples, mini-tutorials, and complete programs is:
>
> The Perl Cookbook (the "Ram Book"):
> by Tom Christiansen and Nathan Torkington,
> with Foreword by Larry Wall
> ISBN 0-596-00313-7 [2nd Edition August 2003]
> http://www.oreilly.com/catalog/perlckbk2/
>
> If you're already a seasoned programmer, then the Camel Book might
> suffice for you to learn Perl. If you're not, check out the Llama book:
>
> Learning Perl
> by Randal L. Schwartz, Tom Phoenix, and brian d foy
> ISBN 0-596-10105-8 [4th edition July 2005]
> http://www.oreilly.com/catalog/learnperl4/
>
My feeling, when first learning Perl, and doing so via PP,
was that *everything* was there, it was all well explained,
one hell of a well-written book, a combination of tutorial and
reference manual.
But it, to me, was like "drinking out of a firehose", to use that
useful expression.
Now, there's a book that I *never* see mentioned here in clpm,
probably because the author maybe never attends eg the summer
conference (yapc), etc, nor (maybe) ever posts to this group,
or whose personality rubs someone the wrong way (just my wild-ass
guesses), but I discovered it in a bookstore (borders), bought
it, and found it really, really good.
It's "Pro Perl", by Peter Wainwright, from Apress, is 1,000pgs long,
covers *lots* of the same stuff that does PP, has many more
examples, excellent explanations, easy to read, and maybe best
of all, is NOT like "drinking from a firehose".
I know that no one here is going to believe me on this --
I mean, who in this clpm/yapc/etc has ever heard of this Wainwright guy
(well, he did write (as one of three authors) the WROX book
"Professional Perl Development", which I have, but have not
read yet, and if maybe (I don't know this) it's not the greatest
thing on Perl, that does NOT take anything from the "Pro Perl"
book (by Wainwright alone).)
And even someone learning Perl from his book -- really ALSO needs
to have PP -- AND the book on references, *anything* by Conway (3
so far, I think), and advanced perl 2nd ed, etc, etc -- there's
so much, and so much to explain, and so many ways of doing things
(hmm, have I maybe heard that before?), etc.
But for a FIRST (and surprisingly complete) perl text, I'd
for sure recommend this "Pro Perl".
Now, maybe at least *one* of you, one whose opinion everyone
trusts, *buys* a copy -- just not that expensive, especially
from bookpool.
Hell, maybe *I'll* have to pay for it -- that'd be one of my
few decent contributions to the Perl community.
And, by the way, there's nothing in this for me, I've never
met or talked to either this guy or anyone from the publisher.
I just think that when something decent (well, wonderful)
comes along by someone other than from our local clique of authors,
we owe it to the Perl audience to let them know it exists.
By the way, I have not seen it in any bookstore for several
years. Probably because it never gets recommended by, say,
us, it's sales are so low that no one stocks it.
Anyway, please one *or more* of you guys get a copy
and flip through the pages, and ask yourself "if I had
a programmer-friend who knew no Perl, but wanted to learn
it, would I recommend *this* book."
And also ask that if the book should be listed in this FAQ,
WHERE it should be. I myself would say right up there after
PP -- but you'll have to get the book yourself to understand
why I say that. It's that good.
----
Well, I've tried. Breaking into a clique is really hard.
Thanks for at least reading what I've written here!
Sincerely,
David
> And for more advanced information on writing larger programs, presented
> in the same style as the Llama book, continue your education with the
> Alpaca book:
>
> Intermediate Perl (the "Alpaca Book")
> by Randal L. Schwartz and brian d foy, with Tom Phoenix (foreword by Damian Conway)
> ISBN 0-596-10206-2 [1st edition March 2006]
> http://www.oreilly.com/catalog/lrnperlorm/
>
> Addison-Wesley ( http://www.awlonline.com/ ) and Manning (
> http://www.manning.com/ ) are also publishers of some fine Perl books
> such as *Object Oriented Programming with Perl* by Damian Conway and
> *Network Programming with Perl* by Lincoln Stein.
>
...
------------------------------
Date: Sun, 18 May 2008 22:42:39 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: FAQ 4.41 How can I remove duplicate elements from a list or array?
Message-Id: <x7od73utcw.fsf@mail.sysarch.com>
>>>>> "s" == szr <szrRE@szromanMO.comVE> writes:
s> Dr.Ruud wrote:
>> Bad practice. You are still building up a sep*a*rate hash, called
>> %::seen.
s> Point taken, though my goal was to show how to do what was shown at the
s> end of the FAQ with one less line.
s> And how about?
s> my @array = (1, 2, 3, 6, 4, 4, 5, 6, 5, 7);
s> my @unique = grep { ! $::_{$_}++; } @array;
s> print join ', ', @unique;
so you changed the name to %_. it is still a global and could be full of
data before you run that code as it is not cleared first.
and trying to save a declare line is losing the sight of the whole
concept of hashes being a way to uniquify data.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Sun, 18 May 2008 18:58:40 -0700 (PDT)
From: sharma__r@hotmail.com
Subject: Find all variables used.
Message-Id: <7d76d916-4c34-46f4-992e-7fe520fca2c8@b9g2000prh.googlegroups.com>
Hi,
Is there a way (apart from grepping) to list out all the variables
(viz., scalars/array/hashes/code/etc.)
that have been declared &/or used in a perl program? The variables are
of the
package/lexical/local/global variety.
Thanks,
Rakesh
------------------------------
Date: Mon, 19 May 2008 01:32:38 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: floating bar in the line chart
Message-Id: <g0qlbm$sfc$1@reader2.panix.com>
In article <5c2s04dh6q7qu4cvpciga5fba4mthcldhi@4ax.com>,
zentara <zentara@highstream.net> wrote:
>On Mon, 21 Apr 2008 10:43:59 +0530, "Vakayil Thobias"
><vakayil.thobias@alcatel-lucent.com> wrote:
>
>>Hello,
>>
>>How can create a line chart with bar in the graph ?
>>I am using perl+win32
>>
>>Thanks in advance.
>>Regards,
>>Thobias
>>
>
>You can make anything you want on a Tk::Canvas( or a similar widget
>like Tk::Zinc, Goo::Canvas, etc).
>
>Of course, you will have to do the work of making your own axis.
>
>zentara
Sure would be nice -- VERY, VERY USEFUL, TOO -- if someone who
familiar with tk, as well as with various CPAN chart/graph-drawing
stuff, would, as a tutorial example, code-up such a thing (a simple one,
of course),
OR, maybe a more effective and "cost-effective" (time+effort being the costs)
way to go would be to have the .pl-program simply do the drawing, etc,
via the (open-source) "R" system, an (the?) open-source replacement for
the (non-free) "S" ("the NEW S Language" was its name) package?
Opinions?
Worth a sub-thread?
Thanks,
David
------------------------------
Date: 18 May 2008 20:51:42 GMT
From: xhoster@gmail.com
Subject: Re: I need ideas on how to sort 350 million lines of data
Message-Id: <20080518165145.140$qH@newsreader.com>
chadda@lonemerchant.com wrote:
> I have roughly 350 million lines of data in the following form
>
> name, price, weight, brand, sku, upc, size
Name, in particular, seems like it might be able to contain embedded
punctuation and might be escaped in some way. That could complicate
things
> sitting on my home PC.
What kind of PC is your home PC?
> Is there some kind of sane way to sort this without taking up too much
> ram
As long as you have plenty of scratch space, Linux's system sort will
use temp files to sort things much larger than main memory. For all I
know, Window's DOS emulator's sort will as well. But it is a matter of
whether you can get the system sort command to sort on the field and
collation sequence you want sorted. If not, you could use Perl to
transform the data into something more acceptable, use the system sort,
then transform it back.
> or jacking up my limited CPU time?
Sorting 350 million records will take some CPU time. I don't know what
you consider to be "jacking up" or how limited you think your CPU time.
My CPUs are limited to about 86,400 seconds per day, rather I am using
them or not.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Sun, 18 May 2008 17:14:35 -0700 (PDT)
From: Bill H <bill@ts1000.us>
Subject: Re: I need ideas on how to sort 350 million lines of data
Message-Id: <08bb3cf1-8d1d-4a60-9405-e0961b98944a@k37g2000hsf.googlegroups.com>
On May 17, 11:21=A0am, cha...@lonemerchant.com wrote:
> I have roughly 350 million lines of data in the following form
>
> name, price, weight, brand, sku, upc, size
>
> sitting on my home PC.
>
> Is there some kind of sane way to sort this without taking up too much
> ram or jacking up my limited CPU time?
Just out of curiosity I would like to know how someone has a file
containing 350 million line of product information sitting on a home
pc in the first place. I mean it had to have come from some sort of
database to start with, and withthose numbers we aren't talking about
a second hand store.
Bill H
------------------------------
Date: Sun, 18 May 2008 22:35:49 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Need ideas on how to make this code faster than a speeding turtle
Message-Id: <x7skwfutoa.fsf@mail.sysarch.com>
>>>>> "IZ" == Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:
IZ> [A complimentary Cc of this posting was sent to
IZ> Uri Guttman
IZ> <uri@stemsystems.com>], who wrote in article <x7tzgy1aus.fsf@mail.sysarch.com>:
>> >> better but forking off lynx is still slow. LWP should be much faster. if
>> >> you want speed (and with the data size you have, you want it), use LWP.
>>
IZ> This may depend on many parameters, but the overhead of
IZ> system()ing may be quite low. The overhead of opening a new HTTP
IZ> connection for each line may be larger. LWP will have a chance to
IZ> use persistent connections...
>>
>> i highly doubt forking lynx and it doing a fetch with passing the page
>> back via a pipe would be faster than a direct call to lwp and getting
>> the page in ram. it would have to be a very odd system for the lynx
>> solution to be faster.
>>
>> and lynx would have to always open a new connection as forked procs have
>> no memory.
IZ> I do not think you understood what I wrote.
so make it clearer the next time you write.
IZ> I'm not claiming that *this* overhead is small. What I say is that
IZ> *other* overheads may be not negligible.
IZ> Anyway, all overheads I know are in favor on LWP.
my point too.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Sun, 18 May 2008 23:24:59 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Order of operations (was: FAQ 4.47 How do I handle circular lists?)
Message-Id: <rum6g5-4711.ln1@osiris.mauzo.dyndns.org>
Quoth "szr" <szrRE@szromanMO.comVE>:
> Peter J. Holzer wrote:
> > On 2008-05-18 15:15, Dr.Ruud <rvtol+news@isolution.nl> wrote:
> >> sheinrich@my-deja.com schreef:
> [...]
> > That sentence is very clear when taken out of context. Unfortunately,
> > it is much less clear in the context of perlop. Firstly, it is in the
> > section "Auto-increment and Auto-decrement", not in the section
> > "Assignment Operators". So does it only apply to ++ and -- or is
> >
> > ($i = 1) + ($i = 2)
> >
> > also undefined? (it is in C)
>
> This seems quite defined to me; assignments occur first, going left to
> right, so $i becomes 2 (ok, it becomes 1 and then immediately becomes
> 2), and then you add (+), resulting in 2 + 2, which of course is 4. This
> seems to hold true across the board:
That's not the correct interpretation. Assignments happen as they are
needed, with the whole expression being evaluated in order of
precedence. What's weird is that ($i = 1) doesn't return 1, it returns
an alias to $i (presumably so expressions like
($i = "x") =~ s/x/y/;
can work correctly), which means sometimes assignments appear to
have happened earlier than they actually did. (This leads to the
bizarre fact that
($i = 1) = 2;
is valid Perl, whereas it certainly isn't valid C.)
For instance, this
~% perl -le'print +($i = 1) + ($i = 2) + ($i = 3)'
7
at first makes no sense, until you realise the order of evaluation is
1: $i = 1 # returns an alias to $i
2: $i = 2 # returns another alias to $i
3: add #1 and #2 # since $i is now 2, this returns 4
4: $i = 3 # returns another alias to $i
5: add #3 and #4 # since $i is now 3, this returns 7
It's important to realise that 'undefined' doesn't mean the same thing
in the Perl docs as it does in the C standard. In C, 'undefined'
basically means 'different implementations are allowed to do different
things'; since Perl only has one implementation, that doesn't apply. In
Perl, it means something more like 'perl's behaviour here is somewhat
subtle, and we don't promise not to change it'. Treating the perldocs as
a specification you can wave at people is rather silly: when perl's
behaviour doesn't match the docs, it's not given which will be treated
as 'correct'.
Ben
--
Every twenty-four hours about 34k children die from the effects of poverty.
Meanwhile, the latest estimate is that 2800 people died on 9/11, so it's like
that image, that ghastly, grey-billowing, double-barrelled fall, repeated
twelve times every day. Full of children. [Iain Banks] ben@morrow.me.uk
------------------------------
Date: Mon, 19 May 2008 00:52:55 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Order of operations (was: FAQ 4.47 How do I handle circular lists?)
Message-Id: <slrng31cq7.jhc.hjp-usenet2@hrunkner.hjp.at>
On 2008-05-18 20:06, szr <szrRE@szromanMO.comVE> wrote:
> Peter J. Holzer wrote:
>> On 2008-05-18 15:15, Dr.Ruud <rvtol+news@isolution.nl> wrote:
>>> sheinrich@my-deja.com schreef:
> [...]
>> That sentence is very clear when taken out of context. Unfortunately,
>> it is much less clear in the context of perlop. Firstly, it is in the
>> section "Auto-increment and Auto-decrement", not in the section
>> "Assignment Operators". So does it only apply to ++ and -- or is
>>
>> ($i = 1) + ($i = 2)
>>
>> also undefined? (it is in C)
>
> This seems quite defined to me; assignments occur first, going left to
> right,
Where is this defined?
> so $i becomes 2 (ok, it becomes 1 and then immediately becomes
> 2), and then you add (+), resulting in 2 + 2, which of course is 4.
Which is something I would *not* have expected and reeks strongly of
undefined behaviour.
> This
> seems to hold true across the board:
>
> $ perl5.10.0 -Mstrict -we 'my $i=5; print(($i = 1) + ($i = 2), "\n")'
> 4
>
> $ perl5.8.8 -Mstrict -we 'my $i=5; print(($i = 1) + ($i = 2), "\n")'
> 4
>
> $ perl5.8.2 -Mstrict -we 'my $i=5; print(($i = 1) + ($i = 2), "\n")'
> 4
>
> $ perl5.8.0 -Mstrict -we 'my $i=5; print(($i = 1) + ($i = 2), "\n")'
> 4
>
> $ perl5.6.1 -Mstrict -we 'my $i=5; print(($i = 1) + ($i = 2), "\n")'
> 4
Irrelevant. Just because all implementations you have access to behave
the same doesn't mean the behaviour is defined.
hp
------------------------------
Date: Mon, 19 May 2008 03:19:34 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Order of operations
Message-Id: <al6Yj.2909$Yp.303@edtnps92>
Ben Morrow wrote:
> Quoth "szr" <szrRE@szromanMO.comVE>:
>> Peter J. Holzer wrote:
>>> On 2008-05-18 15:15, Dr.Ruud <rvtol+news@isolution.nl> wrote:
>>>> sheinrich@my-deja.com schreef:
>> [...]
>>> That sentence is very clear when taken out of context. Unfortunately,
>>> it is much less clear in the context of perlop. Firstly, it is in the
>>> section "Auto-increment and Auto-decrement", not in the section
>>> "Assignment Operators". So does it only apply to ++ and -- or is
>>>
>>> ($i = 1) + ($i = 2)
>>>
>>> also undefined? (it is in C)
>> This seems quite defined to me; assignments occur first, going left to
>> right, so $i becomes 2 (ok, it becomes 1 and then immediately becomes
>> 2), and then you add (+), resulting in 2 + 2, which of course is 4. This
>> seems to hold true across the board:
>
> That's not the correct interpretation. Assignments happen as they are
> needed, with the whole expression being evaluated in order of
> precedence.
I've had this discussion on c.l.p.misc before and it has been (rightly)
pointed out to me that precedence does not determine order of evaluation.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
------------------------------
Date: 18 May 2008 21:18:23 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Perl 6
Message-Id: <Xns9AA2A5DF968E9castleamber@130.133.1.4>
"Gordon Etly" <g.etly@bentsys.INVALID.com> wrote:
> John Bokma wrote:
>> "Gordon Etly" <get@INVALIDbentsys.com> wrote:
[..]
>> Yup, that's online discussing stuff for you. I am a little like that
>> too I guess, and I see this behavior a lot. I have little doubt that
>> if you meet those people IRL they are really nice people. Also,
>> dealing every day with people who are too lazy to even pick a decent
>> subject, and expect that "the Usenet people" act as their private
>> help desk (free at that), makes someone not always replying in a nice
>> way, even to serious questions (it's the main reason why I am giving
>> up on Usenet again (and permanently this time), real soon).
>
> While I mostly agree, I still believe that if one feels they are going
> to reply in a negative manner, it may be better just not to post.
Yes, I have tried that as well, and decided to give up on Usenet
entirely (well, almost). Too many people who want free help on their own
terms. I don't mind the free part, but I do mind that instead of a
"thank you" one might get a personal attack instead.
> The
> worst part about how people like post is they act as if someone is
> forcing them to post, when the reality is they could just move on to
> another post or take a break in general. It seems people who are
> otherwise quite helpful, when they start posting negatively, they lose
> focus on the helping aspect.
Yup, the people who need help insist too hard on getting help, and
forgot often that this is not a help desk. People who want to help often
get carried away: they have reserved a certain amount of time to post
every day, and if there is nothing to post, they look closer at other
posts. At least that's how it works for me.
>> Duh! Times are different, it's not the late 80's anymore. If it
>> helps, think of Perl 6 as a new language, not a next release of Perl
>> 5.x that requires that the first digit is incremented.
>
> Actually I believe Perl 5 came out in the mid 90's or so, and it was
> too reguarded as a new language comapred to Perl 4 and before, was it
> not? (Granted, Perl 6 does seems like a much larger leap from P5 than
> P5 from P4.)
I learned Perl with Perl 4, and to me it was not a big step to Perl 5.
All new things where just - to me, and what I can recall from that time
- logical extensions to Perl 4. With Perl 6 I don't have that feeling.
To me it looks more like a new language based on Perl 5. (Or: a logical
rewrite of Perl 5 instead of a logical extension).
>> But why the hurry? PHP is at version 6, (or is it 7 already) and from
>> what I've heard their Unicode support is still flaky.
>
> According to http://www.php.net/downloads.php, the currently stable
> release is 5.2.6, so unless you're referring to the minor part, I'm
> not usre where you got those numbers.
<http://blog.agoraproduction.com/index.php?/archives/19-Installing-PHP6-
F
or-beginners.html>
Written almost 1.5 years ago.
> Agreed, more peopel could check that list and it might help, but one
> also has to wonder if they are trying to do too many things at a time.
> IMHO, it may (have) be(en) better to do some features for the initial
> release, get it out, and then add additional feature for the next
> release(s), rather than everything at once.
But that is exactly what has been done. You can have some of the
features already by using Perl6:: modules [1] in Perl5. Moreover, some
features (like say) are "backported" to Perl5.
[1] Perl6::Junction, Perl6::Role, Perl6::Binding, etc.
--
John
http://johnbokma.com/perl/
------------------------------
Date: 18 May 2008 21:04:31 GMT
From: xhoster@gmail.com
Subject: Re: Problems with GetOpt
Message-Id: <20080518170433.897$52@newsreader.com>
Paul Richardson <prich@earthlink.net> wrote:
> print "Printing vf file \n";
> print $alternate_dot_vf_file;
> die;
Printing to stdout hooked up to a terminal is by default line-buffered.
Your second print doesn't have an eol, and so it not printed, but
just buffered. When you die, the buffer doesn't get flushed, so the
last partial line is discarded.
Nothing to do with GetOpt.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Sun, 18 May 2008 14:56:35 -0700
From: Paul Richardson <prich@earthlink.net>
Subject: Re: Problems with GetOpt
Message-Id: <1211154837_1605@news.usenet.com>
On 2008-05-17 09:51:57 -0700, Dirk Heinrichs <dirk.heinrichs@online.de> said:
> Paul Richardson wrote:
>
>> I am trying have following perl code:
>>
>> #!/usr/bin/perl
>> #
>> # Options for this script
>> # -c : compile only don't simulate
>> # -gui: invoke simulator with the gui
>> #
>> use lib '/usr/lib/perl5/5.8.5/Getopt';
>
> What's this good for?
For some reason my path for searching was set up correctly
>
>> use Getopt::Long;
>> #
>> my $alternate_dot_vf_file = '';
>> #
>> GetOptions('f=s' => \$alternate_dot_vf_file);
>> print "Printing vf file \n";
>> print $alternate_dot_vf_file;
>
> Looks good, except for missing '. "\n"' at the end of last line.
ok
>
>> die;
>
> Why "die" when there is no error? Better "exit (0)".
ok
>
>> My expectation would have been that if I invoked this code "lets call
>> it hack" as follows:
>>
>> hack --f someRandomFileName
>>
>> I would have got print out that said:
>> Printing vf file
>> someRandonFileName
>
> And what do you get?
I got n nothing as in , nothing was printed out , I expected to see
"someRandomFileName" printed out
>
>> I am using the is my spefication to GetOptions incorrect ?
>
> Yes.
>
> Bye...
>
> Dirk
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Sun, 18 May 2008 14:56:57 -0700
From: Paul Richardson <prich@earthlink.net>
Subject: Re: Problems with GetOpt
Message-Id: <1211154858_1606@news.usenet.com>
On 2008-05-18 14:04:31 -0700, xhoster@gmail.com said:
> Paul Richardson <prich@earthlink.net> wrote:
>
>> print "Printing vf file \n";
>> print $alternate_dot_vf_file;
>> die;
>
> Printing to stdout hooked up to a terminal is by default line-buffered.
> Your second print doesn't have an eol, and so it not printed, but
> just buffered. When you die, the buffer doesn't get flushed, so the
> last partial line is discarded.
>
> Nothing to do with GetOpt.
>
> Xho
Thanks
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Mon, 19 May 2008 00:48:09 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: The map function
Message-Id: <g0qio9$5el$1@reader2.panix.com>
In article <1209000030_3085@news.newsgroups.com>,
Gerry Ford <gerry@nowhere.ford> wrote:
...
>--
>"Life in Lubbock, Texas, taught me two things: One is that God loves you
>and you're going to burn in hell. The other is that sex is the most
>awful, filthy thing on earth and you should save it for someone you love."
>
>~~ Butch Hancock
>
>
THAT is one good quotation to hang on the wall!
David
------------------------------
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 1554
***************************************