[30487] in Perl-Users-Digest
Perl-Users Digest, Issue: 1730 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 18 06:09:41 2008
Date: Fri, 18 Jul 2008 03:09:06 -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 Fri, 18 Jul 2008 Volume: 11 Number: 1730
Today's topics:
Re: C linked lists in Perl <uri@stemsystems.com>
Re: C linked lists in Perl <joost@zeekat.nl>
Re: comma quoted lists question <hjp-usenet2@hjp.at>
Re: How to identify a 32 or 64 bit OS? <nospam-abuse@ilyaz.org>
new CPAN modules on Fri Jul 18 2008 (Randal Schwartz)
Re: Numerically sort a file on a given column where col sln@netherlands.com
Re: Numerically sort a file on a given column where col (Jens Thoms Toerring)
Re: Numerically sort a file on a given column where col <uri@stemsystems.com>
Posting Guidelines for comp.lang.perl.misc ($Revision: tadmc@seesig.invalid
Re: remove previous lines of a log file (Jens Thoms Toerring)
understading double scalar variable $$ <slick.users@gmail.com>
Re: understading double scalar variable $$ <joost@zeekat.nl>
Re: understading double scalar variable $$ <ben@morrow.me.uk>
Re: understading double scalar variable $$ <joost@zeekat.nl>
Re: understading double scalar variable $$ <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 17 Jul 2008 23:57:10 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: C linked lists in Perl
Message-Id: <x7k5fkjc89.fsf@mail.sysarch.com>
>>>>> "TZ" == Ted Zlatanov <tzz@lifelogs.com> writes:
TZ> On Thu, 17 Jul 2008 17:26:58 GMT Uri Guttman <uri@stemsystems.com> wrote:
>>>>>>> "TZ" == Ted Zlatanov <tzz@lifelogs.com> writes:
TZ> Lisp pretty much is all about linked lists, they are built into
TZ> everything.
UG> sure but other than car and cdr (great names! and i know why) and dotted
UG> pair, it doesn't have any builtin support for linked lists. you still
UG> need to work at making them with primitives.
TZ> On Thu, 17 Jul 2008 11:15:34 -0400 smallpond <smallpond@juno.com> wrote:
s> In lisp a list can be built from cons cells. It is not a data type in
s> lisp any more than in C.
TZ> I really don't know how much more "built-in" linked lists can be than
TZ> what you find in Lisp, considering that code and data both are lists and
TZ> treated as such by the language, and you can construct either
TZ> dynamically. At this point you're arguing that with Lisp you have an
TZ> assembled band saw (vs. Perl's Swiss Army knife or Java's diesel-powered
TZ> hammer-screwdriver) but you can't use it until you plug it in. Well,
TZ> yeah, but that is not an argument worth having.
yeah, like arguing with brick walls over PERL vs Perl. :)
what i meant about builtin was stuff that does insert/delete/lookup
stuff. any linked list thing needs those and related funcs to be
useful. even lisp doesn't do that directly. but no matter.
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: Fri, 18 Jul 2008 02:19:07 +0200
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: C linked lists in Perl
Message-Id: <87tzeorqmc.fsf@zeekat.nl>
Uri Guttman <uri@stemsystems.com> writes:
> what i meant about builtin was stuff that does insert/delete/lookup
> stuff. any linked list thing needs those and related funcs to be
> useful. even lisp doesn't do that directly. but no matter.
But (common) lisp *does* provide functions that do just that.
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
------------------------------
Date: Fri, 18 Jul 2008 11:40:38 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: comma quoted lists question
Message-Id: <slrng80p8o.mj8.hjp-usenet2@hrunkner.hjp.at>
On 2008-07-16 16:09, Leon Timmermans <fawaka@gmail.com> wrote:
> On Wed, 16 Jul 2008 05:40:39 -0700, cartercc wrote:
>> Okay, I got both WriteExcel and ParseExcel, and will play with them next
>> week. Just offhand, do you know whether ParseExcel will work with Office
>> 2007? Will WriteExcel work with Office 2007? If you know they will not,
>> it will save me some time.
>>
>> Thanks, CC.
>
> They will use the old XLS format, which should work just fine with Excel
> 2007. There is a Spreadsheet-WriteExcelXML class to write XLSX files, but
> there doesn't seem to be a class that reads them yet. It should work just
> fine, as long as your users don't try to convert your XML files to XLSX.
ITYM "convert your XLS files to XLSX". That might be a problem. If a
user opens an XLS file with Excel 2007, changes something and then saves
it, will the file be saved as an XLS file or an XLSX file? What if they
use "Save as" or use some feature which previous versions of Excel
didn't have?
hp
------------------------------
Date: Fri, 18 Jul 2008 03:25:45 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: How to identify a 32 or 64 bit OS?
Message-Id: <g5p2fp$16cf$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Ted Zlatanov
<tzz@lifelogs.com>], who wrote in article <86prpcnt49.fsf@lifelogs.com>:
> IZ> The perl's I build support this for many years. I submitted the patch
> IZ> about 2003.
>
> Do you know why the patch hasn't been accepted yet? I couldn't find it
> through Google or archive searches.
I have no idea. I think I'm sitting on a hundred of such patches... :-(
Yours,
Ilya
P.S. I tried to google for it, and could not find it either...
I have 2 versions, for 5.8.2, and for 5.8.7.
------------------------------
Date: Fri, 18 Jul 2008 04:42:21 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Fri Jul 18 2008
Message-Id: <K46qEL.vC0@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
AnyEvent-4.21
http://search.cpan.org/~mlehmann/AnyEvent-4.21/
provide framework for multiple event loops
----
BDB-1.7
http://search.cpan.org/~mlehmann/BDB-1.7/
Asynchronous Berkeley DB access
----
Bundle-KohaSupport-0.3
http://search.cpan.org/~koha/Bundle-KohaSupport-0.3/
A bundle of the required Perl modules for Koha Intergrated Library System
----
CPANPLUS-YACSmoke-0.01_02
http://search.cpan.org/~bingos/CPANPLUS-YACSmoke-0.01_02/
Yet Another CPANPLUS Smoke Tester
----
CSS-Minifier-XS-0.03
http://search.cpan.org/~gtermars/CSS-Minifier-XS-0.03/
XS based CSS minifier
----
Cache-Memcached-Fast-0.11
http://search.cpan.org/~kroki/Cache-Memcached-Fast-0.11/
Perl client for memcached, in C language
----
Catalyst-View-TT-Filters-LazyLoader-0.07
http://search.cpan.org/~tomyhero/Catalyst-View-TT-Filters-LazyLoader-0.07/
TT View Class with Template::Filters::LazyLoader support.
----
Chart-Clicker-1.99_01
http://search.cpan.org/~gphat/Chart-Clicker-1.99_01/
Powerful, extensible charting.
----
Class-DBI-Lite-0.002_01
http://search.cpan.org/~johnd/Class-DBI-Lite-0.002_01/
Lightweight ORM for Perl
----
Class-Declare-Attributes-0.07
http://search.cpan.org/~ibb/Class-Declare-Attributes-0.07/
Class::Declare method types using Perl attributes.
----
DBIx-Log4perl-0.12
http://search.cpan.org/~mjevans/DBIx-Log4perl-0.12/
Perl extension for DBI to selectively log SQL, parameters, result-sets, transactions etc to a Log::Log4perl handle.
----
Data-Rlist-1.41
http://search.cpan.org/~aspindler/Data-Rlist-1.41/
----
File-ShareDir-1.00
http://search.cpan.org/~adamk/File-ShareDir-1.00/
Locate per-dist and per-module shared files
----
Geo-Coder-Yahoo-0.41
http://search.cpan.org/~abh/Geo-Coder-Yahoo-0.41/
Geocode addresses with the Yahoo! API
----
IPC-System-Simple-0.13
http://search.cpan.org/~pjf/IPC-System-Simple-0.13/
Run commands simply, with detailed diagnostics
----
JavaScript-Minifier-XS-0.05
http://search.cpan.org/~gtermars/JavaScript-Minifier-XS-0.05/
XS based JavaScript minifier
----
Lingua-JA-FindDates-0.006
http://search.cpan.org/~bkb/Lingua-JA-FindDates-0.006/
find Japanese dates & convert them
----
Mac-CocoaDialog-0.0.1
http://search.cpan.org/~polettix/Mac-CocoaDialog-0.0.1/
script with CocoaDialog
----
Module-Install-0.76
http://search.cpan.org/~adamk/Module-Install-0.76/
Standalone, extensible Perl module installer
----
MooseX-App-Cmd-0.04
http://search.cpan.org/~dmaki/MooseX-App-Cmd-0.04/
Mashes up MooseX::Getopt and App::Cmd.
----
MooseX-AttributeHelper-Set-Object-0.01
http://search.cpan.org/~doy/MooseX-AttributeHelper-Set-Object-0.01/
Attribute helper for Set::Object
----
Mouse-0.05
http://search.cpan.org/~sartak/Mouse-0.05/
Moose minus the antlers
----
Net-SFTP-Foreign-1.42
http://search.cpan.org/~salva/Net-SFTP-Foreign-1.42/
SSH File Transfer Protocol client
----
POE-Component-Server-SimpleXMLRPC-0.02
http://search.cpan.org/~catone/POE-Component-Server-SimpleXMLRPC-0.02/
----
Perl6-GatherTake-0.0.3
http://search.cpan.org/~moritz/Perl6-GatherTake-0.0.3/
Perl 6 like gather { take() } for Perl 5
----
Queue-Leaky-0.01
http://search.cpan.org/~tawan/Queue-Leaky-0.01/
Queues with leaky buckets
----
RDF-Simple-Serialiser-Notation3-1.012
http://search.cpan.org/~mthurn/RDF-Simple-Serialiser-Notation3-1.012/
Output RDF triples in Notation3 format
----
SVN-Notify-2.76
http://search.cpan.org/~dwheeler/SVN-Notify-2.76/
Subversion activity notification
----
Test-Aggregate-0.30
http://search.cpan.org/~ovid/Test-Aggregate-0.30/
Aggregate *.t tests to make them run faster.
----
Test-Refcount-0.01
http://search.cpan.org/~pevans/Test-Refcount-0.01/
assert reference counts on objects
----
Text-Phonetic-1.05
http://search.cpan.org/~maros/Text-Phonetic-1.05/
A module implementing various phonetic algorithms
----
WWW-Romeo-0.21.01
http://search.cpan.org/~mgregoro/WWW-Romeo-0.21.01/
Where for art thou?
----
WWW-Search-Ask-1.009
http://search.cpan.org/~mthurn/WWW-Search-Ask-1.009/
class for searching www.search.com
----
WWW-WhitePages-2008.0717
http://search.cpan.org/~ermeyers/WWW-WhitePages-2008.0717/
WhitePages Development Interface (WPDI)
----
WWW-WhitePages-2008.0718
http://search.cpan.org/~ermeyers/WWW-WhitePages-2008.0718/
WhitePages Development Interface (WPDI)
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Thu, 17 Jul 2008 22:49:36 GMT
From: sln@netherlands.com
Subject: Re: Numerically sort a file on a given column where column is a $var
Message-Id: <71jv74tdismm46v7d8pc4ms94nvont42n9@4ax.com>
On Thu, 17 Jul 2008 14:29:52 -0700 (PDT), joemacbusiness@yahoo.com wrote:
>Hi All,
>
>I want a subroutine that will sort a file on any given column.
Maybe your just in a rush, but I stopped reading here, when I read "sort a file"
sln
------------------------------
Date: 18 Jul 2008 01:04:09 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: Numerically sort a file on a given column where column is a $var
Message-Id: <6ea8g9F63ajdU1@mid.uni-berlin.de>
joemacbusiness@yahoo.com wrote:
> Hi All,
> I want a subroutine that will sort a file on any given column.
> So I have a file like this:
> 300 400 500 600 700
> 33 2337483 482 78374 4567
> 10 20 30 40 50
> 1000 1001 1002 1003 1004
> 9 8 7 6 5
> And I run my numericSortCol() routine on it sorting on
> column 1 and should get this:
> 9 8 7 6 5
> 10 20 30 40 50
> 300 400 500 600 700
> 1000 1001 1002 1003 1004
> 33 2337483 482 78374 4567
> The problem is that I cannot get the bynum() to accept 2 args.
> The code will work if I hard-code the $col in bynum, and
> tweek the "problem line" a bit but that defeats the purpose of the
> "sort on column" feature.
> ######################### Here's the code I have so far:
> [joe@localhost work]$ cat test18.pl
> #!/usr/bin/perl
> my $infile = "test18.in";
> open(F,"$infile") || print "cannot open $infile $!";
> my @array = <F>;
> close(F);
> numericSortCol(1,\@array);
> sub numericSortCol {
> my $col = shift;
> my $aref = shift;
> foreach my $item (sort bynum($col,@{ $aref })){ # <<<< problem
> line??
Look again at the documentation for the sort function. It takes
either a block or a function (that itself expects two arguments)
and, as the second argument, a list to be sorted. Your use of
sort doesn't seem to fit that very well and I guess if you had
used 'use warnings;' you would have been told so...
> print "item: $item\n";
> }
> }
> sub bynum {
> my $col = shift;
> @a = split(/\s+/,$a);
> @b = split(/\s+/,$b);
> $a[$col] <=> $b[$col];
> }
The simplest solution is probaly not to use a function name when
calling sort but instead a block like this:
#!/usr/bin/perl
use strict;
use warnings;
my @array = <DATA>;
numericSortCol( 1, \@array );
sub numericSortCol {
my ( $col, $aref ) = @_;
print "item: $_"
for sort { ( split /\s+/, $a )[ $col ] <=>
( split /\s+/, $b )[ $col ] } @$aref;
}
__DATA__
300 400 500 600 700
33 2337483 482 78374 4567
10 20 30 40 50
1000 1001 1002 1003 1004
9 8 7 6 5
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
------------------------------
Date: Fri, 18 Jul 2008 00:41:58 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Numerically sort a file on a given column where column is a $var
Message-Id: <x7ej5sja5k.fsf@mail.sysarch.com>
>>>>> "j" == joemacbusiness <joemacbusiness@yahoo.com> writes:
j> The problem is that I cannot get the bynum() to accept 2 args.
j> The code will work if I hard-code the $col in bynum, and
j> tweek the "problem line" a bit but that defeats the purpose of the
j> "sort on column" feature.
j> open(F,"$infile") || print "cannot open $infile $!";
useless use of quotes on a scalar. not needed and it can be a bug.
j> my @array = <F>;
j> close(F);
use File::Slurp ;
my @data = read_file( $infile ) ;
j> numericSortCol(1,\@array);
j> sub numericSortCol {
j> my $col = shift;
j> my $aref = shift;
j> foreach my $item (sort bynum($col,@{ $aref })){ # <<<< problem
j> line??
well, that isn't how perl's sort works. it can take a sub name (you have
a sub call) or a code block.
and you should look at Sort::Maker which can do this for you
easily. just create a simple expression to get the column you want based
on $_. that could be something like:
(split( ' ', $_))[$col]
the rest i leave as an exercise.
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: Fri, 18 Jul 2008 07:10:49 GMT
From: tadmc@seesig.invalid
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)
Message-Id: <ZlXfk.12778$LG4.1465@nlpi065.nbdc.sbc.com>
Outline
Before posting to comp.lang.perl.misc
Must
- Check the Perl Frequently Asked Questions (FAQ)
- Check the other standard Perl docs (*.pod)
Really Really Should
- Lurk for a while before posting
- Search a Usenet archive
If You Like
- Check Other Resources
Posting to comp.lang.perl.misc
Is there a better place to ask your question?
- Question should be about Perl, not about the application area
How to participate (post) in the clpmisc community
- Carefully choose the contents of your Subject header
- Use an effective followup style
- Speak Perl rather than English, when possible
- Ask perl to help you
- Do not re-type Perl code
- Provide enough information
- Do not provide too much information
- Do not post binaries, HTML, or MIME
Social faux pas to avoid
- Asking a Frequently Asked Question
- Asking a question easily answered by a cursory doc search
- Asking for emailed answers
- Beware of saying "doesn't work"
- Sending a "stealth" Cc copy
Be extra cautious when you get upset
- Count to ten before composing a followup when you are upset
- Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------
Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)
This newsgroup, commonly called clpmisc, is a technical newsgroup
intended to be used for discussion of Perl related issues (except job
postings), whether it be comments or questions.
As you would expect, clpmisc discussions are usually very technical in
nature and there are conventions for conduct in technical newsgroups
going somewhat beyond those in non-technical newsgroups.
The article at:
http://www.catb.org/~esr/faqs/smart-questions.html
describes how to get answers from technical people in general.
This article describes things that you should, and should not, do to
increase your chances of getting an answer to your Perl question. It is
available in POD, HTML and plain text formats at:
http://www.rehabitation.com/clpmisc.shtml
For more information about netiquette in general, see the "Netiquette
Guidelines" at:
http://andrew2.andrew.cmu.edu/rfc/rfc1855.html
A note to newsgroup "regulars":
Do not use these guidelines as a "license to flame" or other
meanness. It is possible that a poster is unaware of things
discussed here. Give them the benefit of the doubt, and just
help them learn how to post, rather than assume that they do
know and are being the "bad kind" of Lazy.
A note about technical terms used here:
In this document, we use words like "must" and "should" as
they're used in technical conversation (such as you will
encounter in this newsgroup). When we say that you *must* do
something, we mean that if you don't do that something, then
it's unlikely that you will benefit much from this group.
We're not bossing you around; we're making the point without
lots of words.
Do *NOT* send email to the maintainer of these guidelines. It will be
discarded unread. The guidelines belong to the newsgroup so all
discussion should appear in the newsgroup. I am just the secretary that
writes down the consensus of the group.
Before posting to comp.lang.perl.misc
Must
This section describes things that you *must* do before posting to
clpmisc, in order to maximize your chances of getting meaningful replies
to your inquiry and to avoid getting flamed for being lazy and trying to
have others do your work.
The perl distribution includes documentation that is copied to your hard
drive when you install perl. Also installed is a program for looking
things up in that (and other) documentation named 'perldoc'.
You should either find out where the docs got installed on your system,
or use perldoc to find them for you. Type "perldoc perldoc" to learn how
to use perldoc itself. Type "perldoc perl" to start reading Perl's
standard documentation.
Check the Perl Frequently Asked Questions (FAQ)
Checking the FAQ before posting is required in Big 8 newsgroups in
general, there is nothing clpmisc-specific about this requirement.
You are expected to do this in nearly all newsgroups.
You can use the "-q" switch with perldoc to do a word search of the
questions in the Perl FAQs.
Check the other standard Perl docs (*.pod)
The perl distribution comes with much more documentation than is
available for most other newsgroups, so in clpmisc you should also
see if you can find an answer in the other (non-FAQ) standard docs
before posting.
It is *not* required, or even expected, that you actually *read* all of
Perl's standard docs, only that you spend a few minutes searching them
before posting.
Try doing a word-search in the standard docs for some words/phrases
taken from your problem statement or from your very carefully worded
"Subject:" header.
Really Really Should
This section describes things that you *really should* do before posting
to clpmisc.
Lurk for a while before posting
This is very important and expected in all newsgroups. Lurking means
to monitor a newsgroup for a period to become familiar with local
customs. Each newsgroup has specific customs and rituals. Knowing
these before you participate will help avoid embarrassing social
situations. Consider yourself to be a foreigner at first!
Search a Usenet archive
There are tens of thousands of Perl programmers. It is very likely
that your question has already been asked (and answered). See if you
can find where it has already been answered.
One such searchable archive is:
http://groups.google.com/advanced_group_search
If You Like
This section describes things that you *can* do before posting to
clpmisc.
Check Other Resources
You may want to check in books or on web sites to see if you can
find the answer to your question.
But you need to consider the source of such information: there are a
lot of very poor Perl books and web sites, and several good ones
too, of course.
Posting to comp.lang.perl.misc
There can be 200 messages in clpmisc in a single day. Nobody is going to
read every article. They must decide somehow which articles they are
going to read, and which they will skip.
Your post is in competition with 199 other posts. You need to "win"
before a person who can help you will even read your question.
These sections describe how you can help keep your article from being
one of the "skipped" ones.
Is there a better place to ask your question?
Question should be about Perl, not about the application area
It can be difficult to separate out where your problem really is,
but you should make a conscious effort to post to the most
applicable newsgroup. That is, after all, where you are the most
likely to find the people who know how to answer your question.
Being able to "partition" a problem is an essential skill for
effectively troubleshooting programming problems. If you don't get
that right, you end up looking for answers in the wrong places.
It should be understood that you may not know that the root of your
problem is not Perl-related (the two most frequent ones are CGI and
Operating System related), so off-topic postings will happen from
time to time. Be gracious when someone helps you find a better place
to ask your question by pointing you to a more applicable newsgroup.
How to participate (post) in the clpmisc community
Carefully choose the contents of your Subject header
You have 40 precious characters of Subject to win out and be one of
the posts that gets read. Don't waste them. Take care while
composing them, they are the key that opens the door to getting an
answer.
Spend them indicating what aspect of Perl others will find if they
should decide to read your article.
Do not spend them indicating "experience level" (guru, newbie...).
Do not spend them pleading (please read, urgent, help!...).
Do not spend them on non-Subjects (Perl question, one-word
Subject...)
For more information on choosing a Subject see "Choosing Good
Subject Lines":
http://www.cpan.org/authors/id/D/DM/DMR/subjects.post
Part of the beauty of newsgroup dynamics, is that you can contribute
to the community with your very first post! If your choice of
Subject leads a fellow Perler to find the thread you are starting,
then even asking a question helps us all.
Use an effective followup style
When composing a followup, quote only enough text to establish the
context for the comments that you will add. Always indicate who
wrote the quoted material. Never quote an entire article. Never
quote a .signature (unless that is what you are commenting on).
Intersperse your comments *following* each section of quoted text to
which they relate. Unappreciated followup styles are referred to as
"top-posting", "Jeopardy" (because the answer comes before the
question), or "TOFU" (Text Over, Fullquote Under).
Reversing the chronology of the dialog makes it much harder to
understand (some folks won't even read it if written in that style).
For more information on quoting style, see:
http://web.presby.edu/~nnqadmin/nnq/nquote.html
Speak Perl rather than English, when possible
Perl is much more precise than natural language. Saying it in Perl
instead will avoid misunderstanding your question or problem.
Do not say: I have variable with "foo\tbar" in it.
Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
or I have $var = <DATA> (and show the data line).
Ask perl to help you
You can ask perl itself to help you find common programming mistakes
by doing two things: enable warnings (perldoc warnings) and enable
"strict"ures (perldoc strict).
You should not bother the hundreds/thousands of readers of the
newsgroup without first seeing if a machine can help you find your
problem. It is demeaning to be asked to do the work of a machine. It
will annoy the readers of your article.
You can look up any of the messages that perl might issue to find
out what the message means and how to resolve the potential mistake
(perldoc perldiag). If you would like perl to look them up for you,
you can put "use diagnostics;" near the top of your program.
Do not re-type Perl code
Use copy/paste or your editor's "import" function rather than
attempting to type in your code. If you make a typo you will get
followups about your typos instead of about the question you are
trying to get answered.
Provide enough information
If you do the things in this item, you will have an Extremely Good
chance of getting people to try and help you with your problem!
These features are a really big bonus toward your question winning
out over all of the other posts that you are competing with.
First make a short (less than 20-30 lines) and *complete* program
that illustrates the problem you are having. People should be able
to run your program by copy/pasting the code from your article. (You
will find that doing this step very often reveals your problem
directly. Leading to an answer much more quickly and reliably than
posting to Usenet.)
Describe *precisely* the input to your program. Also provide example
input data for your program. If you need to show file input, use the
__DATA__ token (perldata.pod) to provide the file contents inside of
your Perl program.
Show the output (including the verbatim text of any messages) of
your program.
Describe how you want the output to be different from what you are
getting.
If you have no idea at all of how to code up your situation, be sure
to at least describe the 2 things that you *do* know: input and
desired output.
Do not provide too much information
Do not just post your entire program for debugging. Most especially
do not post someone *else's* entire program.
Do not post binaries, HTML, or MIME
clpmisc is a text only newsgroup. If you have images or binaries
that explain your question, put them in a publically accessible
place (like a Web server) and provide a pointer to that location. If
you include code, cut and paste it directly in the message body.
Don't attach anything to the message. Don't post vcards or HTML.
Many people (and even some Usenet servers) will automatically filter
out such messages. Many people will not be able to easily read your
post. Plain text is something everyone can read.
Social faux pas to avoid
The first two below are symptoms of lots of FAQ asking here in clpmisc.
It happens so often that folks will assume that it is happening yet
again. If you have looked but not found, or found but didn't understand
the docs, say so in your article.
Asking a Frequently Asked Question
It should be understood that you may have missed the applicable FAQ
when you checked, which is not a big deal. But if the Frequently
Asked Question is worded similar to your question, folks will assume
that you did not look at all. Don't become indignant at pointers to
the FAQ, particularly if it solves your problem.
Asking a question easily answered by a cursory doc search
If folks think you have not even tried the obvious step of reading
the docs applicable to your problem, they are likely to become
annoyed.
If you are flamed for not checking when you *did* check, then just
shrug it off (and take the answer that you got).
Asking for emailed answers
Emailed answers benefit one person. Posted answers benefit the
entire community. If folks can take the time to answer your
question, then you can take the time to go get the answer in the
same place where you asked the question.
It is OK to ask for a *copy* of the answer to be emailed, but many
will ignore such requests anyway. If you munge your address, you
should never expect (or ask) to get email in response to a Usenet
post.
Ask the question here, get the answer here (maybe).
Beware of saying "doesn't work"
This is a "red flag" phrase. If you find yourself writing that,
pause and see if you can't describe what is not working without
saying "doesn't work". That is, describe how it is not what you
want.
Sending a "stealth" Cc copy
A "stealth Cc" is when you both email and post a reply without
indicating *in the body* that you are doing so.
Be extra cautious when you get upset
Count to ten before composing a followup when you are upset
This is recommended in all Usenet newsgroups. Here in clpmisc, most
flaming sub-threads are not about any feature of Perl at all! They
are most often for what was seen as a breach of netiquette. If you
have lurked for a bit, then you will know what is expected and won't
make such posts in the first place.
But if you get upset, wait a while before writing your followup. I
recommend waiting at least 30 minutes.
Count to ten after composing and before posting when you are upset
After you have written your followup, wait *another* 30 minutes
before committing yourself by posting it. You cannot take it back
once it has been said.
AUTHOR
Tad McClellan and many others on the comp.lang.perl.misc newsgroup.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: 17 Jul 2008 23:59:29 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: remove previous lines of a log file
Message-Id: <6ea4n1F622b8U1@mid.uni-berlin.de>
rajesh <sivarajesh.jarugula@gmail.com> wrote:
> On Jul 16, 5:44 am, j...@toerring.de (Jens Thoms Toerring) wrote:
> > At least for your input file it deletes just the lines 9, 10 and
> > 11, as you wanted to. But please note:
> >
> > a) if 'ENUMERR' does appear in the first two lines nothing happens
> > to that lines, your specifications did not cover the case, so I
> > have no idea what you want to happen then
> > b) it does only remove the first instance 'ENUMERR' (and the two
> > lines before, you didn't tell what to do if it shows up a
> > second (or third etc.) time.
>
> Thanks for the Solution. It looks work fine. But What I
> need is that it should happen through out the file where the keyword
> occurs.
Sorry, but that was never meant as a complete solution for
your (somewhat underspecified) problem but just as a sketch
of a way you could try to do it. If you have problems get-
ting it done yourself going from there don't hesitate to post
here for discussions and hints (but include your own attempt).
But if you just want a full-blown solution with all bells and
whistles without writing it yourself this is not the right
place to ask. Look instead for groups with the word 'jobs' in
their names (or websites like www.rentacoder.com).
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
------------------------------
Date: Thu, 17 Jul 2008 16:55:50 -0700 (PDT)
From: Slickuser <slick.users@gmail.com>
Subject: understading double scalar variable $$
Message-Id: <93e3d97f-4a40-42a4-9349-0b40a36b7371@r35g2000prm.googlegroups.com>
I understand the code is removing spaces but I don't get with using
the double scalar.
$$text ??
And why we need an else?
my($text) = @_;
if ($text)
{
$$text =~ s/^\s+//;
$$text =~ s/\s+$//;
}
else
{
s/^\s+//;
s/\s+$//;
}
------------------------------
Date: Fri, 18 Jul 2008 02:17:54 +0200
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: understading double scalar variable $$
Message-Id: <87y740rqod.fsf@zeekat.nl>
Slickuser <slick.users@gmail.com> writes:
> I understand the code is removing spaces but I don't get with using
> the double scalar.
>
> $$text ??
see perdoc perlref
> And why we need an else?
i seriously doubt that you do. Though there may be edge cases.
> my($text) = @_;
> if ($text)
> {
> $$text =~ s/^\s+//;
> $$text =~ s/\s+$//;
> }
> else
> {
> s/^\s+//;
> s/\s+$//;
> }
>
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
------------------------------
Date: Fri, 18 Jul 2008 02:26:43 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: understading double scalar variable $$
Message-Id: <j385l5-69s.ln1@osiris.mauzo.dyndns.org>
Quoth Joost Diepenmaat <joost@zeekat.nl>:
> Slickuser <slick.users@gmail.com> writes:
>
> > I understand the code is removing spaces but I don't get with using
> > the double scalar.
> >
> > $$text ??
>
> see perdoc perlref
>
>
> > And why we need an else?
>
> i seriously doubt that you do. Though there may be edge cases.
Huh? The sub defaults to operating on $_ if no argument is supplied.
That's hardly an 'edge case'.
> > else
> > {
> > s/^\s+//;
> > s/\s+$//;
> > }
Ben
--
"Faith has you at a disadvantage, Buffy."
"'Cause I'm not crazy, or 'cause I don't kill people?"
"Both, actually."
[ben@morrow.me.uk]
------------------------------
Date: Fri, 18 Jul 2008 03:51:37 +0200
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: understading double scalar variable $$
Message-Id: <87lk00rmc6.fsf@zeekat.nl>
Ben Morrow <ben@morrow.me.uk> writes:
> Huh? The sub defaults to operating on $_ if no argument is supplied.
> That's hardly an 'edge case'.
What sub? Here's the original code:
my($text) = @_;
if ($text)
{
$$text =~ s/^\s+//;
$$text =~ s/\s+$//;
}
else
{
s/^\s+//;
s/\s+$//;
}
This means that if the first argument evaluates to "false" (which is
not at all the same as "not supplying an argument"), the else clause is
executed and $_ is modified. IMHO that seems like very sloppy and
unusual coding.
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
------------------------------
Date: Fri, 18 Jul 2008 03:30:33 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: understading double scalar variable $$
Message-Id: <x7fxq7j2cm.fsf@mail.sysarch.com>
>>>>> "JD" == Joost Diepenmaat <joost@zeekat.nl> writes:
JD> Ben Morrow <ben@morrow.me.uk> writes:
>> Huh? The sub defaults to operating on $_ if no argument is supplied.
>> That's hardly an 'edge case'.
JD> What sub? Here's the original code:
JD> my($text) = @_;
JD> if ($text)
JD> {
JD> $$text =~ s/^\s+//;
JD> $$text =~ s/\s+$//;
JD> }
JD> else
JD> {
JD> s/^\s+//;
JD> s/\s+$//;
JD> }
JD> This means that if the first argument evaluates to "false" (which is
JD> not at all the same as "not supplying an argument"), the else clause is
JD> executed and $_ is modified. IMHO that seems like very sloppy and
JD> unusual coding.
but notice $text is supposed to be a scalar ref. so if no arg is passed
in, the sub works on $_. if $text is set, it works on the scalar
value. if $text isn't a scalar ref it dies.
this is the guts from some kiddie's trim sub which take a ref to a
scalar to trim or defaults to working on $_. not something i would ever
write like that. well, in general i don't use $_ unless i have to. i
like named variables.
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: 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 1730
***************************************